Files
HeroesStone_PRC8/_module/nss/tk_cep_changes.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

1001 lines
44 KiB
Plaintext

/* CEP spells changelog.
*
* Here are recorded the changes made to BioWare scripts to accommodate
* CEP appearances, races, and items (and to fix some ommissions on BioWare's
* part).
* The actual functions follow the description of the changes.
*
Include files:
=============
nw_i0_spells
------------
AmIAHumanoid() -- Add brownie race (53).
x0_i0_spells
------------
spellsIsFlying() -- Add BioWare's flying seagull, G'Zhorb, pseudodragon,
and sharks (goblin, hammerhead, and mako), as well as
many (over 100) CEP appearances.
spellsIsImmuneToPetrification() -- Add BioWare's lich, invisible stalker,
skeleton warrior 2, helmed horror, mingon,
new golems (diamon, emerald, and ruby),
archery target, combat dummy, chair, table,
candelabra, chest, magic sparks (8 colors),
flame (3 sizes), and drow boat, as well as
many (over 150) CEP appearances.
spellsIsMindless() -- Add plant (52).
x0_i0_match
-----------
MatchDoubleHandedWeapon() -- Add falchion (305), falchion2 (316), maul (318),
mercurial greatsword (320), and double scimitar (321).
Remove BASE_ITEM_MAGICSTAFF.
MatchSingleHandedWeapon() -- Add trident (300), heavy pick (301), light pick (302),
sai (303), nunchaku (304), sap (308), assassin dagger (309), katar (310),
mace2 (312), kukri2 (313), fashion accessory (314), heavy mace (317),
mercurial longsword (319), goad (322), wind-fire wheel (323),
maug double sword (324), and longsword2 (330).
Add BASE_ITEM_MAGICSTAFF.
VerifyCombatMeleeTalent() -- Add plant (52).
Bug fix: single "=" in if's should be doubled: "==".
x2_i0_spells
------------
GetMeleeWeapon() -- Add trident (300), heavy pick (301), light pick (302),
sai (303), nunchaku (304), falchion (305), sap (308), assassin dagger (309), katar (310),
mace2 (312), kukri2 (313), fashion accessory (314), falchion2 (316), heavy mace (317), maul (318),
mercurial longsword (319), mercurial greatsword (320), double scimitar (321),
goad (322), wind-fire wheel (323), maug double sword (324), and longsword2 (330).
GetSlashingWeapon() -- Add falchion (305), kukri2 (313), falchion2 (316),
mercurial longsword (319), mercurial greatsword (320), double scimitar (321),
wind-fire wheel (323), maug double sword (324), and longsword2 (330).
prc_x2_itemprop
---------------
IPGetIsMeleeWeapon() -- Add trident (300), heavy pick (301), light pick (302),
sai (303), nunchaku (304), falchion (305), sap (308), assassin dagger (309), katar (310),
mace2 (312), kukri2 (313), fashion accessory (314), falchion2 (316), heavy mace (317), maul (318),
mercurial longsword (319), mercurial greatsword (320), double scimitar (321),
goad (322), wind-fire wheel (323), maug double sword (324), and longsword2 (330).
IPGetTargetedOrEquippedMeleeWeapon() -- Fix to check all three creature weapon slots.
Spell files recompiled:
======================
nw_s0_daze
x0_s0_fleshsto
x0_s0_laugh
x0_s1_petrbreath
x0_s1_petrgaze
x0_s1_petrtouch
x0_s3_alchem
x0_s3_calen
x0_s3_calhb
x2_s0_blckstff
x2_s0_bldethst
x2_s0_blssweap
x2_s0_darkfire
x2_s0_deafclng
x2_s0_flmeweap
x2_s0_grmagweap
x2_s0_holysword
x2_s0_keenedge
x2_s0_magcweap
x2_s1_beholdray
x2_s1_petrgaze
x2_s2_poisonwp
Spell files changed:
===================
x0_s1_petrtouch: strength of petrification now determined by petrifier, not petrifiee.
x2_s0_bldethst: spell cast at event now sent to item possessor instead of the item.
x2_s0_holysword: spell cast at event now sent to item possessor instead of the item.
x2_s0_keenedge: spell cast at event now sent to item possessor instead of the item.
x2_s1_beholdray: revised to route the petrification through DoPetrification() in x0_i0_spells.
*
*/
/*
* ===========================================
* Here are the new versions of the functions
* from the include files.
* ===========================================
*/
// nw_i0_spells
// ------------
#include "prc_inc_spells"
// * Returns true if Target is a humanoid
int AmIAHumanoid(object oTarget)
{
int nRacial = GetRacialType(oTarget);
if ( nRacial == RACIAL_TYPE_DWARF ||
nRacial == RACIAL_TYPE_HALFELF ||
nRacial == RACIAL_TYPE_HALFORC ||
nRacial == RACIAL_TYPE_ELF ||
nRacial == RACIAL_TYPE_GNOME ||
nRacial == RACIAL_TYPE_HUMANOID_GOBLINOID ||
nRacial == RACIAL_TYPE_HALFLING ||
nRacial == RACIAL_TYPE_HUMAN ||
nRacial == RACIAL_TYPE_HUMANOID_MONSTROUS ||
nRacial == RACIAL_TYPE_HUMANOID_ORC ||
nRacial == RACIAL_TYPE_HUMANOID_REPTILIAN ||
nRacial == 53 ) // CEP: Brownie
{
return TRUE;
}
// Default: not humanoid.
return FALSE;
}
// x0_i0_spells
// ------------
// * Returns TRUE or FALSE depending on whether the creature is flying or not.
int spellsIsFlying(object oCreature)
{
// First check for a flying phenotype.
int nPheno = GetPhenoType(oCreature);
if ( nPheno == 16 || nPheno == 25 )
// Part-based creature set to appear to be flying.
return TRUE;
// We are identifying appearances that are "flying".
// This operation is optimized into a two-tiered decision tree.
int nAppearance = GetAppearanceType(oCreature);
switch ( nAppearance / 100 )
{
case 0: // BioWare appearances 0 - 99.
switch ( nAppearance )
{
case 10: // APPEARANCE_TYPE_BAT
case 11: // APPEARANCE_TYPE_BAT_HORROR
case 52: // APPEARANCE_TYPE_ELEMENTAL_AIR
case 53: // APPEARANCE_TYPE_ELEMENTAL_AIR_ELDER
case 55: // APPEARANCE_TYPE_FAIRY
case 68: // APPEARANCE_TYPE_ELEMENTAL_WATER_ELDER
case 69: // APPEARANCE_TYPE_ELEMENTAL_WATER
return TRUE;
}
break;
case 1: // BioWare appearances 100 - 199.
// Take care of a largish range.
if ( 103 <= nAppearance && nAppearance <= 116 ) // LANTERN_ARCHON, QUASIT, IMP, MEPHIT_AIR, MEPHIT_DUST, MEPHIT_EARTH,
return TRUE; // MEPHIT_FIRE, MEPHIT_ICE, MEPHIT_SALT, MEPHIT_OOZE, MEPHIT_STEAM,
// MEPHIT_MAGMA, MEPHIT_WATER, and WILL_O_WISP.
// The rest can be done via a switch.
switch ( nAppearance )
{
case 100: // APPEARANCE_TYPE_HELMED_HORROR
case 144: // APPEARANCE_TYPE_FALCON
case 145: // APPEARANCE_TYPE_RAVEN
case 146: // APPEARANCE_TYPE_SHADOW
case 147: // APPEARANCE_TYPE_SHADOW_FIEND
case 156: // APPEARANCE_TYPE_SPECTRE
case 186: // APPEARANCE_TYPE_ALLIP
case 187: // APPEARANCE_TYPE_WRAITH
return TRUE;
}
break;
case 2: // BioWare appearances 200-299.
switch ( nAppearance )
{
case 291: // APPEARANCE_TYPE_SEAGULL_FLYING
case 299: // Beholder, G'Zhorb
return TRUE;
}
break;
case 3: // BioWare appearances 300-399.
if ( 374 <= nAppearance && nAppearance <= 385 ) // FAERIE_DRAGON, PSEUDODRAGON, WYRMLING_RED, WYRMLING_BLUE,
return TRUE; // WYRMLING_BLACK, WYRMLING_GREEN, WYRMLING_WHITE, WYRMLING_BRASS,
break; // WYRMLING_COPPER, WYRMLING_BRONZE, WYRMLING_SILVER, WYRMLING_GOLD
case 4: // BioWare appearances 400-499.
switch ( nAppearance )
{
case 401: // APPEARANCE_TYPE_BEHOLDER
case 402: // APPEARANCE_TYPE_BEHOLDER_MAGE
case 403: // APPEARANCE_TYPE_BEHOLDER_EYEBALL
case 419: // APPEARANCE_TYPE_HARPY
case 430: // APPEARANCE_TYPE_DEMI_LICH
case 447: // APPEARANCE_TYPE_SHARK_MAKO
case 448: // APPEARANCE_TYPE_SHARK_HAMMERHEAD
case 449: // APPEARANCE_TYPE_SHARK_GOBLIN
case 472: // APPEARANCE_TYPE_BEHOLDER_MOTHER
return TRUE;
}
break;
// Skipping cases 5-9. There are BioWare appearances, but none fly.
case 10: // CEP appearances 1000-1099.
switch ( nAppearance )
{
case 1046: // Beholder: B*
case 1050: // Stirge: Cave*
case 1072: // Terradon
case 1073: // Flying Eye*
case 1087: // Terradon: Large
case 1099: // Visage*
return TRUE;
}
break;
case 11: // CEP appearances 1100-1199.
switch ( nAppearance )
{
case 1100: // Visage, Greater*
case 1104: // Belker*
case 1171: // Bugs*
case 1172: // Bugs, Large*
return TRUE;
}
break;
case 12: // CEP appearances 1200-1299.
switch ( nAppearance )
{
case 1218: // Mechanon, Cutter*
case 1259: // Vampiric Mist 2*
case 1275: // Eagle*
case 1281: // Bat, Battle*
case 1282: // Bat, Bone*
case 1290: // Wendigo*
return TRUE;
}
break;
case 13: // CEP appearances 1300-1399.
if ( nAppearance == 1307 ) // Demilich B*
return TRUE;
if ( 1342 <= nAppearance && nAppearance <= 1347 ) // Elemental, Air L*; Elemental, Air M*; Elemental, Air S*;
return TRUE; // Elemental, Smoke L*; Elemental, Smoke M*; Elemental, Smoke S*
if ( 1354 <= nAppearance && nAppearance <= 1359 ) // Elemental, Water L*; Elemental, Water M*; Elemental, Water S*;
return TRUE; // Elemental, Fire L*; Elemental, Fire M*; Elemental, Fire S*
if ( 1366 <= nAppearance && nAppearance <= 1368 ) // Elemental, Radiance L*; Elemental, Radiance M*; Elemental, Radiance S*
return TRUE;
if ( 1372 <= nAppearance && nAppearance <= 1377 ) // Elemental, Steam L*; Elemental, Steam M*; Elemental, Steam S*;
return TRUE; // Elemental, Lightning L*; Elemental, Lightning M*; Elemental, Lightning S*
if ( 1384 <= nAppearance && nAppearance <= 1389 ) // Elemental, Ash L*; Elemental, Ash M*; Elemental, Ash S*;
return TRUE; // Elemental, Vacuum L*; Elemental, Vacuum M*; Elemental, Vacuum S*
break;
case 14: // CEP appearances 1400-1499.
switch ( nAppearance )
{
case 1419: // Feather Snake**
case 1421: // Animated Wheel*
case 1425: // Animated Tome*
case 1426: // Animated Chest, Flying*
case 1431: // Stirge A*
case 1432: // Stirge B*
case 1435: // Flying Book A*
case 1436: // Flying Book B*
case 1437: // Flying Book C*
case 1494: // Wasp, Giant*
return TRUE;
}
break;
case 15: // CEP appearances 1500-1599.
if ( nAppearance == 1508 ) // Beholder:Death Tyrant**
return TRUE;
if ( 1556 <= nAppearance && nAppearance <= 1565 ) // Dragon: Flying - Red**; Dragon: Flying - Black**; Dragon: Flying - Blue**;
return TRUE; // Dragon: Flying - Gold**; Dragon: Flying - White**; Dragon: Flying - Silver**;
// Dragon: Flying - Copper**; Dragon: Flying - Green**;
// Dragon: Flying - Brass**; Dragon: Flying - Bronze**
break;
// Skipping cases 16 and 17. No flying appearances.
case 18: // CEP appearances 1800-1899.
if ( 1807 <= nAppearance && nAppearance <= 1817 ) // Flying Vampire Female**; Flying Vampire Male**; Flying Kobold**;
// exclude Werecat Artic [SB]** // Flying Succubus**; [1811 skipped]; Flying Erinyes**; Flying Kobold B**;
return nAppearance != 1811; // Flying Kobold Chief A**; Flying Kobold Chief B**; Flying Kobold ShamanA**;
// Flying Kobold ShamanB**
if ( 1871 <= nAppearance && nAppearance <= 1882 ) // Elemental: Lava**; Elemental: Death**; Elemental: Floral**; Flying Book: Death**;
// exclude Barghest v2** // Flying Book: Myst**; Shark: Mako - low**; Shark: Goblin - low**; [1878 skipped];
return nAppearance != 1878; // Shark: Great White**; Shark: Great White - low**; Shark: Tiger**;
// Shark: Tiger - low**
if ( 1891 <= nAppearance && nAppearance <= 1893 ) // Eagle, Legend**; Bat: Fruit**; Bat: LeafNosed**
return TRUE;
break;
case 19: // CEP appearances 1900-1999.
if ( 1947 <= nAppearance && nAppearance <= 1952 ) // Bird: Owl, Brown**; Bird: Owl, Snowy**; Bird: Owl, Barn**; Bird: Owl, Great**;
return TRUE; // Bird: Owl, Gray**; Bird: Owl, Black**
if ( 1956 <= nAppearance && nAppearance <= 1965 ) // Bird: Macaw**; Bird: Macaw, Red**; Bird: Macaw, Blue**; Bird: Parrot, Grey**;
return TRUE; // Bird: Cockatoo, White**; Bird: Cockatoo, Black**; Bird: Parrot, Green**;
// Bird: Toucan**; Bird: Albatross**; Bird: Puffin**
if ( 1975 <= nAppearance && nAppearance <= 1979 ) // Bird: Blue Jay**; Bird: Cardinal**; Bird: Mockingbird**; Bird: Blackbird**;
return TRUE; // Bird: Oriole**
if ( nAppearance == 1988 ) // Dragonfly**
return TRUE;
if ( 1990 <= nAppearance && nAppearance <= 1998 ) // Fairy: Blue**; Fairy: Purple**; Fairy: Orange**; Fairy: Pink**;
return TRUE; // Will-O-Wisp: Pink**; Will-O-Wisp: Yellow**; Will-O-Wisp: Purple**;
// Will-O-Wisp: Orange**; Will-O-Wisp: Green**
break;
// Skipping cases 20 to 24. No flying appearances.
case 25: // CEP appearances 2500-2599.
if ( nAppearance == 2507 ) // Skully
return TRUE;
break;
// Skipping cases 26 to 30. No flying appearances.
case 31: // CEP appearances 3100-3199.
switch ( nAppearance )
{
case 3121: // Efreeti: Noble**
case 3122: // Dao**
case 3123: // Marid**
case 3124: // Djinni**
case 3127: // Ice Fiend 2**
case 3129: // Elemental: Fire, Grue
case 3130: // Elemental: Air, Grue
return TRUE;
}
break;
// Skipping cases 32 to 38. No flying appearances.
case 39: // CEP appearances 3900-3999.
if ( nAppearance == 3999 ) // Bat: Fruit, Small**
return TRUE;
break;
}//switch (nAppearance/100)
// Default: not flying.
return FALSE;
}//spellsIsFlying()
// * returns true if the creature has flesh
int spellsIsImmuneToPetrification(object oCreature)
{
// * GZ: Sept 2003 - Prevent people from petrifying DM, resulting in GUI even when
// effect is not successful.
// I think this is now prevention. -- TK.
if ( GetIsDM(oCreature) )
return TRUE;
// We are identifying appearances that have no flesh.
// (Plus the petrifiers -- medusa, gorgon, cockatrice.)
// This operation is optimized into a two-tiered decision tree.
int nAppearance = GetAppearanceType(oCreature);
switch ( nAppearance / 100 )
{
case 0: // BioWare appearances 0 - 99.
switch ( nAppearance )
{
case 11: // APPEARANCE_TYPE_BAT_HORROR
case 24: // APPEARANCE_TYPE_GOLEM_BONE
case 36: // APPEARANCE_TYPE_SKELETAL_DEVOURER
case 39: // APPEARANCE_TYPE_LICH
case 52: // APPEARANCE_TYPE_ELEMENTAL_AIR
case 53: // APPEARANCE_TYPE_ELEMENTAL_AIR_ELDER
case 56: // APPEARANCE_TYPE_ELEMENTAL_EARTH
case 57: // APPEARANCE_TYPE_ELEMENTAL_EARTH_ELDER
return TRUE;
}
if ( 60 <= nAppearance && nAppearance <= 64 ) // APPEARANCE_TYPE_ELEMENTAL_FIRE, APPEARANCE_TYPE_ELEMENTAL_FIRE_ELDER,
return TRUE; // APPEARANCE_TYPE_SKELETON_PRIEST, APPEARANCE_TYPE_SKELETON_COMMON,
// APPEARANCE_TYPE_INVISIBLE_STALKER
if ( 68 <= nAppearance && nAppearance <= 71 ) // APPEARANCE_TYPE_ELEMENTAL_WATER_ELDER, APPEARANCE_TYPE_ELEMENTAL_WATER,
return TRUE; // APPEARANCE_TYPE_SKELETON_WARRIOR_1, APPEARANCE_TYPE_SKELETON_WARRIOR_2
if ( 89 <= nAppearance && nAppearance <= 92 ) // APPEARANCE_TYPE_GOLEM_IRON, APPEARANCE_TYPE_SHIELD_GUARDIAN,
return TRUE; // APPEARANCE_TYPE_GOLEM_CLAY, APPEARANCE_TYPE_GOLEM_STONE
break;
case 1: // BioWare appearances 100 - 199.
switch ( nAppearance )
{
case 100: // APPEARANCE_TYPE_HELMED_HORROR
case 103: // APPEARANCE_TYPE_LANTERN_ARCHON
case 116: // APPEARANCE_TYPE_WILL_O_WISP
case 119: // APPEARANCE_TYPE_MINOGON
case 156: // APPEARANCE_TYPE_SPECTRE
case 169: // Golem, Emerald
case 173: // Golem, Ruby
case 182: // APPEARANCE_TYPE_SKELETON_CHIEFTAIN
case 186: // APPEARANCE_TYPE_ALLIP
case 187: // APPEARANCE_TYPE_WRAITH
return TRUE;
}
if ( 146 <= nAppearance && nAppearance <= 150 ) // APPEARANCE_TYPE_SHADOW, APPEARANCE_TYPE_SHADOW_FIEND
return TRUE; // APPEARANCE_TYPE_SKELETON_MAGE, Golem Diamond,
// APPEARANCE_TYPE_SKELETON_WARRIOR
break;
case 2: // BioWare appearances 200-299.
switch ( nAppearance )
{
case 200: // APPEARANCE_TYPE_ARCH_TARGET
case 201: // APPEARANCE_TYPE_COMBAT_DUMMY
return TRUE;
}
break;
case 3: // BioWare appearances 300-399.
if ( 352 == nAppearance ) // APPEARANCE_TYPE_MEDUSA
return TRUE;
if ( 367 <= nAppearance && nAppearance <= 370 ) // APPEARANCE_TYPE_GORGON, APPEARANCE_TYPE_COCKATRICE,
return TRUE; // APPEARANCE_TYPE_BASILISK, APPEARANCE_TYPE_HEURODIS_LICH
break;
case 4: // BioWare appearances 400-499.
switch ( nAppearance )
{
case 405: // APPEARANCE_TYPE_DRACOLICH
case 415: // APPEARANCE_TYPE_MINDFLAYER_ALHOON
case 418: // APPEARANCE_TYPE_DRAGON_SHADOW
case 420: // APPEARANCE_TYPE_GOLEM_MITHRAL
case 421: // APPEARANCE_TYPE_GOLEM_ADAMANTIUM
return TRUE;
}
if ( 430 <= nAppearance && nAppearance <= 445 ) // APPEARANCE_TYPE_DEMI_LICH, APPEARANCE_TYPE_OBJECT_CHAIR
return TRUE; // APPEARANCE_TYPE_OBJECT_TABLE, APPEARANCE_TYPE_OBJECT_CANDLE,
// APPEARANCE_TYPE_OBJECT_CHEST, APPEARANCE_TYPE_OBJECT_WHITE,
// APPEARANCE_TYPE_OBJECT_BLUE, APPEARANCE_TYPE_OBJECT_CYAN,
// APPEARANCE_TYPE_OBJECT_GREEN, APPEARANCE_TYPE_OBJECT_YELLOW,
// APPEARANCE_TYPE_OBJECT_ORANGE, APPEARANCE_TYPE_OBJECT_RED,
// APPEARANCE_TYPE_OBJECT_PURPLE, APPEARANCE_TYPE_OBJECT_FLAME_SMALL,
// APPEARANCE_TYPE_OBJECT_FLAME_MEDIUM, APPEARANCE_TYPE_OBJECT_FLAME_LARGE
if ( 469 == nAppearance ) // APPEARANCE_TYPE_ANIMATED_CHEST
return TRUE;
if ( 473 <= nAppearance && nAppearance <= 475 ) // APPEARANCE_TYPE_OBJECT_BOAT, APPEARANCE_TYPE_DWARF_GOLEM,
return TRUE; // APPEARANCE_TYPE_DWARF_HALFORC
break;
// Skipping cases 5-9. There are BioWare appearances, but all have flesh.
case 10: // CEP appearances 1000-1099.
switch ( nAppearance )
{
case 1030: // Armor Stand*
case 1031: // Dracolich B*
case 1047: // Scarecrow*
case 1049: // Skeleton: Small*
case 1066: // Ghost Human: F-Red 3**
case 1095: // Wraith: Hooded 1*
case 1096: // Wraith: Hooded 2*
case 1099: // Visage*
return TRUE;
}
break;
case 11: // CEP appearances 1100-1199.
switch ( nAppearance )
{
case 1100: // Visage, Greater*
case 1101: // Demon: Vorlan*
case 1104: // Belker*
return TRUE;
}
break;
case 12: // CEP appearances 1200-1299.
switch ( nAppearance )
{
case 1216: // Mechanon, Spiker*
case 1217: // Mechanon, Spider*
case 1218: // Mechanon, Cutter*
case 1257: // Minogon B*
case 1259: // Vampiric Mist 2*
case 1277: // Skeleton: Dwarf*
case 1281: // Bat, Battle*
case 1282: // Bat, Bone*
return TRUE;
}
if ( 1285 <= nAppearance && nAppearance <= 1289 ) // Skeleton: Red Eyes*; Skeleton: Flaming*; Skeleton: Green*
return TRUE; // Skeleton: Purple*; Skeleton: Yellow*
break;
case 13: // CEP appearances 1300-1399.
if ( 1307 == nAppearance || 1325 == nAppearance ) // Demilich B*; Vecna*
return TRUE;
if ( 1342 <= nAppearance && nAppearance <= 1389 ) // Elemental, Air L*; Elemental, Air M*; Elemental, Air S*;
return TRUE; // Elemental, Smoke L*; Elemental, Smoke M*; Elemental, Smoke S*;
// Elemental, Magma L*; Elemental, Magma M*; Elemental, Magma S*;
// Elemental, Ooze L*; Elemental, Ooze M*; Elemental, Ooze S*;
// Elemental, Water L*; Elemental, Water M*; Elemental, Water S*;
// Elemental, Fire L*; Elemental, Fire M*; Elemental, Fire S*;
// Elemental, Earth L*; Elemental, Earth M*; Elemental, Earth S*;
// Elemental, Ice L*; Elemental, Ice M*; Elemental, Ice S*;
// Elemental, Radiance L*; Elemental, Radiance M*; Elemental, Radiance S*;
// Elemental, Mineral L*; Elemental, Mineral M*; Elemental, Mineral S*;
// Elemental, Steam L*; Elemental, Steam M*; Elemental, Steam S*;
// Elemental, Lightning L*; Elemental, Lightning M*; Elemental, Lightning S*;
// Elemental, Salt L*; Elemental, Salt M*; Elemental, Salt S*;
// Elemental, Dust L*; Elemental, Dust M*; Elemental, Dust S*;
// Elemental, Ash L*; Elemental, Ash M*; Elemental, Ash S*;
break; // Elemental, Vacuum L*; Elemental, Vacuum M*; Elemental, Vacuum S*
case 14: // CEP appearances 1400-1499.
if ( 1421 <= nAppearance && nAppearance <= 1426 ) // Animated Wheel*; Animated Table*; [1423 skipped]; Animated Chest*;
// Exclude Jagre** // Animated Tome*; Animated Chest, Flying*
return nAppearance != 1423;
if ( 1435 <= nAppearance && nAppearance <= 1437 ) // Flying Book A*; Flying Book B*; Flying Book C*
return TRUE;
if ( 1440 <= nAppearance && nAppearance <= 1447 ) // Skeleton, Pirate 1*; Skeleton, Pirate 2*; Skeleton, Pirate 3*; [1443 and 1444 skipped];
// Exclude Zombie, Pirate 2*; Zombie, Pirate 3*.// Skeleton, Pirate 4*; Skeleton, Pirate 5*; Skeleton, Pirate 6*
return nAppearance != 1443 && nAppearance != 1444;
if ( 1449 == nAppearance || 1451 == nAppearance ) // Ghost Pirate*; Skeleton, Ogre*
return TRUE;
if ( 1486 <= nAppearance && nAppearance <= 1491 ) // Golem: Ruby*; Golem: Emerald*; Golem: Citrine*; Golem: Sapphire*;
return TRUE; // Golem: Amethyst*; Golem: Obsidian*
if ( 1498 <= nAppearance ) // Maug*; Maug, Lieutenant*
return TRUE;
break;
case 15: // CEP appearances 1500-1599.
if ( 1500 == nAppearance || 1504 == nAppearance ) // Maug, Commander*; Maug, Captain*
return TRUE;
if ( 1509 <= nAppearance && nAppearance <= 1514 ) // Golem: Hematite**; Golem: Topaz**; Golem: Diamond**; [1512 skipped];
// Exclude Dragon: Saphire** // Golem: Blackrock**; Golem: Maztica**
return nAppearance != 1512;
if ( 1532 <= nAppearance && nAppearance <= 1536 ) // Golem: Weathered**; Golem: Damaged 1**; Golem: Damaged 2**;
// Exclude Ogre, 3.5e DLA** // [1535 skipped]; Basilisk - Large**
return nAppearance != 1535;
if ( 1579 <= nAppearance && nAppearance <= 1581 ) // Lizard: Lich**; Lizard: Lich, Chief**; Lizard: Lich, Risen**
return TRUE;
break;
// Skipping case 16. All appearances have flesh.
case 17: // CEP appearances 1700-1799.
if ( 1755 <= nAppearance && nAppearance <= 1769 ) // Shield Guard Blue**; Shield Guard Vuong**; Shield Guard Wood**;
// Exclude CEP reserved line. // Elemental: Ice 2**; [1759 skipped]; Shield Guard: Gold**;
return nAppearance != 1759; // Shield Guard: Fatal**; Shield Guard: Black**; Shield Guard: Clan**;
// Shield Guard: Mage**; Shield Guard: Knight**; Shield Guard: Mortar**;
break; // Shield Guard: Bizarro**; Shield Guard: Rust**; Skeleton, Dynamic**
case 18: // CEP appearances 1800-1899.
if ( 1869 <= nAppearance && nAppearance <= 1875 ) // Shadow Lord**; Elemental: Ice**; Elemental: Lava**; Elemental: Death**;
// Exclude Elemental: Floral** // [1873 skipped]; Flying Book: Death**; Flying Book: Myst**
return nAppearance != 1873;
break;
case 19: // CEP appearances 1900-1999.
if ( 1942 == nAppearance ) // Golem: Atlantis**
return TRUE;
if ( 1994 <= nAppearance && nAppearance <= 1998 ) // Will-O-Wisp: Pink**; Will-O-Wisp: Yellow**; Will-O-Wisp: Purple**;
return TRUE; // Will-O-Wisp: Orange**; Will-O-Wisp: Green**
break;
// Skipping cases 20 to 24. All appearances have flesh.
case 25: // CEP appearances 2500-2599.
if ( nAppearance == 2507 ) // Skully
return TRUE;
break;
// Skipping cases 26 to 30. All appearances have flesh.
case 31: // CEP appearances 3100-3199.
if ( nAppearance <= 3116 ) // Ghost Human: F-Red 1**; Ghost Human: F-Red 2**; Ghost Human: F-Blue 1**;
return TRUE; // Ghost Human: F-Blue 2**; Ghost Human: F-Blue 3**; Ghost Human: F-Green 1**;
// Ghost Human: F-Green 2**; Ghost Human: F-Green 3**; Ghost Human: M-Red 1**;
// Ghost Human: M-Red 2**; Ghost Human: M-Red 3**; Ghost Human: M-Blue 1**;
// Ghost Human: M-Blue 2**; Ghost Human: M-Blue 3**; Ghost Human: M-Green 1**;
// Ghost Human: M-Green 2**; Ghost Human: M-Green 3**
if ( 3126 <= nAppearance && nAppearance <= 3130 ) // Ice Fiend 1**; Ice Fiend 2**; Ice Fiend 3**;
return TRUE; // Elemental: Fire, Grue; Elemental: Air, Grue
break;
}//switch (nAppearance/100)
// 03/07/2005 CraigW - Petrification immunity can also be granted as an item property.
// Default: not immune, unless protected by an item property.
return ResistSpell(OBJECT_SELF, oCreature) == 2;
}
// * returns true if oCreature does not have a mind
int spellsIsMindless(object oCreature)
{
switch ( GetRacialType(oCreature) )
{
case RACIAL_TYPE_ELEMENTAL:
case RACIAL_TYPE_UNDEAD:
case RACIAL_TYPE_VERMIN:
case RACIAL_TYPE_CONSTRUCT:
case RACIAL_TYPE_OOZE:
case 52: // CEP: Plant
return TRUE;
}
// Default: has a mind.
return FALSE;
}
// x0_i0_match
// -----------
// TRUE if the item is a double-handed melee weapon (for medium creatures).
int MatchDoubleHandedWeapon(object oItem)
{
switch ( GetBaseItemType(oItem) )
{
// BioWare weapons
case BASE_ITEM_DIREMACE:
case BASE_ITEM_DOUBLEAXE:
case BASE_ITEM_GREATAXE:
case BASE_ITEM_GREATSWORD:
case BASE_ITEM_HALBERD:
case BASE_ITEM_HEAVYFLAIL:
case BASE_ITEM_QUARTERSTAFF:
case BASE_ITEM_SCYTHE:
case BASE_ITEM_SHORTSPEAR:
case BASE_ITEM_TRIDENT:
case BASE_ITEM_TWOBLADEDSWORD:
// CEP weapons
case 305: // falchion
case 316: // falchion2
case 318: // maul
case 320: // mercurial greatsword
case 321: // double scimitar
return TRUE;
}
// Default: not a double-handed melee weapon.
return FALSE;
}
// TRUE if the item is a single-handed melee weapon (for medium creatures).
int MatchSingleHandedWeapon(object oItem)
{
int nItemType = GetBaseItemType(oItem);
if ( nItemType < 300 )
// BioWare weapons.
switch ( nItemType )
{
case BASE_ITEM_BASTARDSWORD:
case BASE_ITEM_BATTLEAXE:
case BASE_ITEM_CLUB:
case BASE_ITEM_DAGGER:
case BASE_ITEM_DWARVENWARAXE:
case BASE_ITEM_HANDAXE:
case BASE_ITEM_KAMA:
case BASE_ITEM_KATANA:
case BASE_ITEM_KUKRI:
case BASE_ITEM_LIGHTFLAIL:
case BASE_ITEM_LIGHTHAMMER:
case BASE_ITEM_LIGHTMACE:
case BASE_ITEM_LONGSWORD:
case BASE_ITEM_MAGICSTAFF:
case BASE_ITEM_MORNINGSTAR:
case BASE_ITEM_RAPIER:
case BASE_ITEM_SCIMITAR:
case BASE_ITEM_SHORTSWORD:
case BASE_ITEM_SICKLE:
case BASE_ITEM_WARHAMMER:
case BASE_ITEM_WHIP:
return TRUE;
}
else
// CEP weapons.
switch ( nItemType )
{
case 300: // CEP trident
case 301: // heavy pick
case 302: // light pick
case 303: // sai
case 304: // nunchaku
case 308: // sap
case 309: // assassin dagger
case 310: // katar
case 312: // mace2
case 313: // kukri2
case 314: // fashion accessory
case 317: // heavy mace
case 319: // mercurial longsword
case 322: // goad
case 323: // wind-fire wheel
case 324: // maug double sword
case 330: // longsword2
return TRUE;
}
// Default: not a single-handed melee weapon.
return FALSE;
}
int VerifyCombatMeleeTalent(talent tUse, object oTarget)
{
// Checks depend on the feat being used.
int nFeatID = GetIdFromTalent(tUse);
if ( nFeatID == FEAT_SAP || nFeatID == FEAT_STUNNING_FIST )
{
// Do not stun/sap those known to be immune to such things.
int nRacial = GetRacialType(oTarget);
return nRacial != RACIAL_TYPE_CONSTRUCT &&
nRacial != RACIAL_TYPE_UNDEAD &&
nRacial != RACIAL_TYPE_ELEMENTAL &&
nRacial != RACIAL_TYPE_VERMIN &&
nRacial != 52; // plant (CEP)
}
else if ( nFeatID == FEAT_SMITE_EVIL )
// Do not smite the good.
return GetAlignmentGoodEvil(oTarget) != ALIGNMENT_GOOD;
else if ( nFeatID == FEAT_SMITE_GOOD )
// Do not smite the evil.
return GetAlignmentGoodEvil(oTarget) != ALIGNMENT_EVIL;
// Not a feat with a special check; allow it.
return TRUE;
}
// x2_i0_spells
// ------------
// Returns TRUE, if oItem is a melee weapon
int GetMeleeWeapon(object oItem)
{
int nItemType = GetBaseItemType(oItem);
if ( nItemType < 300 )
// BioWare weapons.
switch ( nItemType )
{
case BASE_ITEM_BASTARDSWORD:
case BASE_ITEM_BATTLEAXE:
case BASE_ITEM_CLUB:
case BASE_ITEM_DAGGER:
case BASE_ITEM_DIREMACE:
case BASE_ITEM_DOUBLEAXE:
case BASE_ITEM_DWARVENWARAXE:
case BASE_ITEM_GREATAXE:
case BASE_ITEM_GREATSWORD:
case BASE_ITEM_HALBERD:
case BASE_ITEM_HANDAXE:
case BASE_ITEM_HEAVYFLAIL:
case BASE_ITEM_KAMA:
case BASE_ITEM_KATANA:
case BASE_ITEM_KUKRI:
case BASE_ITEM_LIGHTFLAIL:
case BASE_ITEM_LIGHTHAMMER:
case BASE_ITEM_LIGHTMACE:
case BASE_ITEM_LONGSWORD:
case BASE_ITEM_MAGICSTAFF:
case BASE_ITEM_MORNINGSTAR:
case BASE_ITEM_QUARTERSTAFF:
case BASE_ITEM_RAPIER:
case BASE_ITEM_SCIMITAR:
case BASE_ITEM_SCYTHE:
case BASE_ITEM_SHORTSPEAR:
case BASE_ITEM_SHORTSWORD:
case BASE_ITEM_SICKLE:
case BASE_ITEM_TRIDENT:
case BASE_ITEM_TWOBLADEDSWORD:
case BASE_ITEM_WARHAMMER:
case BASE_ITEM_WHIP:
return TRUE;
}
else
// CEP weapons.
switch ( nItemType )
{
case 300: // CEP trident
case 301: // heavy pick
case 302: // light pick
case 303: // sai
case 304: // nunchaku
case 305: // falchion
case 308: // sap
case 309: // assassin dagger
case 310: // katar
case 312: // mace2
case 313: // kukri2
case 314: // fashion accessory
case 316: // falchion2
case 317: // heavy mace
case 318: // maul
case 319: // mercurial longsword
case 320: // mercurial greatsword
case 321: // double scimitar
case 322: // goad
case 323: // wind-fire wheel
case 324: // maug double sword
case 330: // longsword2
return TRUE;
}
// Default: not a melee weapon.
return FALSE;
}
// Returns TRUE if oItem is a slashing weapon.
int GetSlashingWeapon(object oItem)
{
int nItemType = GetBaseItemType(oItem);
if ( nItemType < 300 )
// BioWare weapons.
switch ( nItemType )
{
case BASE_ITEM_BASTARDSWORD:
case BASE_ITEM_BATTLEAXE:
case BASE_ITEM_DOUBLEAXE:
case BASE_ITEM_DWARVENWARAXE:
case BASE_ITEM_GREATAXE:
case BASE_ITEM_GREATSWORD:
case BASE_ITEM_HALBERD:
case BASE_ITEM_HANDAXE:
case BASE_ITEM_KAMA:
case BASE_ITEM_KATANA:
case BASE_ITEM_KUKRI:
case BASE_ITEM_LONGSWORD:
case BASE_ITEM_SCIMITAR:
case BASE_ITEM_SCYTHE:
case BASE_ITEM_SICKLE:
case BASE_ITEM_THROWINGAXE:
case BASE_ITEM_TWOBLADEDSWORD:
case BASE_ITEM_WHIP:
return TRUE;
}
else
// CEP weapons.
switch ( nItemType )
{
case 305: // falchion
case 313: // kukri2
case 316: // falchion2
case 319: // mercurial longsword
case 320: // mercurial greatsword
case 321: // double scimitar
case 323: // wind-fire wheel
case 324: // maug double sword
case 330: // longsword2
return TRUE;
}
// Default: not a slashing weapon.
return FALSE;
}
// prc_x2_itemprop
// ---------------
// Returns TRUE if oItem is a melee weapon.
int IPGetIsMeleeWeapon(object oItem)
{
int nItemType = GetBaseItemType(oItem);
if ( nItemType < 300 )
// BioWare weapons.
switch ( nItemType )
{
case BASE_ITEM_BASTARDSWORD:
case BASE_ITEM_BATTLEAXE:
case BASE_ITEM_CLUB:
case BASE_ITEM_DAGGER:
case BASE_ITEM_DIREMACE:
case BASE_ITEM_DOUBLEAXE:
case BASE_ITEM_DWARVENWARAXE:
case BASE_ITEM_GREATAXE:
case BASE_ITEM_GREATSWORD:
case BASE_ITEM_HALBERD:
case BASE_ITEM_HANDAXE:
case BASE_ITEM_HEAVYFLAIL:
case BASE_ITEM_KAMA:
case BASE_ITEM_KATANA:
case BASE_ITEM_KUKRI:
case BASE_ITEM_LIGHTFLAIL:
case BASE_ITEM_LIGHTHAMMER:
case BASE_ITEM_LIGHTMACE:
case BASE_ITEM_LONGSWORD:
case BASE_ITEM_MAGICSTAFF:
case BASE_ITEM_MORNINGSTAR:
case BASE_ITEM_QUARTERSTAFF:
case BASE_ITEM_RAPIER:
case BASE_ITEM_SCIMITAR:
case BASE_ITEM_SCYTHE:
case BASE_ITEM_SHORTSPEAR:
case BASE_ITEM_SHORTSWORD:
case BASE_ITEM_SICKLE:
case BASE_ITEM_TRIDENT:
case BASE_ITEM_TWOBLADEDSWORD:
case BASE_ITEM_WARHAMMER:
case BASE_ITEM_WHIP:
return TRUE;
}
else
// CEP weapons.
switch ( nItemType )
{
case 300: // CEP trident
case 301: // heavy pick
case 302: // light pick
case 303: // sai
case 304: // nunchaku
case 305: // falchion
case 308: // sap
case 309: // assassin dagger
case 310: // katar
case 312: // mace2
case 313: // kukri2
case 314: // fashion accessory
case 316: // falchion2
case 317: // heavy mace
case 318: // maul
case 319: // mercurial longsword
case 320: // mercurial greatsword
case 321: // double scimitar
case 322: // goad
case 323: // wind-fire wheel
case 324: // maug double sword
case 330: // longsword2
return TRUE;
}
// Default: not a melee weapon.
return FALSE;
}
// Returns the targeted object if it is a melee weapon.
// Otherwise returns a melee weapon equipped by the target.
object IPGetTargetedOrEquippedMeleeWeapon()
{
object oTarget = PRCGetSpellTargetObject();
// Abort on an invalid target.
if ( oTarget == OBJECT_INVALID )
return OBJECT_INVALID;
// See if the target is a melee weapon.
if ( GetObjectType(oTarget) == OBJECT_TYPE_ITEM )
{
if ( IPGetIsMeleeWeapon(oTarget) )
return oTarget;
else
// Items cannot euip other items, so we're done.
return OBJECT_INVALID;
}
// Check the equipped items.
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oTarget);
if ( oWeapon != OBJECT_INVALID && IPGetIsMeleeWeapon(oWeapon) )
return oWeapon;
// Tough to have a weapon in the left hand without one in the right, but...
oWeapon = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oTarget);
if ( oWeapon != OBJECT_INVALID && IPGetIsMeleeWeapon(oWeapon) )
return oWeapon;
// Don't forget the creature weapons.
// These are assumed to be melee weapons.
oWeapon = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oTarget);
if ( oWeapon != OBJECT_INVALID )
return oWeapon;
oWeapon = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oTarget);
if ( oWeapon != OBJECT_INVALID )
return oWeapon;
oWeapon = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oTarget);
if ( oWeapon != OBJECT_INVALID )
return oWeapon;
// Default: no valid weapon target.
return OBJECT_INVALID;
}