I'm unifying the check which verifies whether a spell can be casted on specific place.
I defined the following values to be used in spells:
From the comment above every value, you may learn what will be its meaning; don't care about the other things.Code:enum PowerCanCastFlags { /** Allow casting the spell on enemy creatures kept in custody. */ PwCast_CustodyCrtrs = 0x0001, /** Allow casting the spell on owned creatures not captured by enemy. */ PwCast_OwnedCrtrs = 0x0002, /** Allow casting the spell on creatures of allied players. */ PwCast_AlliedCrtrs = 0x0004, /** Allow casting the spell on creatures of enemy players. */ PwCast_EnemyCrtrs = 0x0008, /** Allow casting the spell on neutral walkable tiles - path, water, lava, rooms owned by neutrals. */ PwCast_NeutrlGround = 0x0010, /** Allow casting the spell on owned ground - rooms floor and claimed ground. */ PwCast_OwnedGround = 0x0020, /** Allow casting the spell on allied players ground - rooms floor and claimed ground. */ PwCast_AlliedGround = 0x0040, /** Allow casting the spell on enemy players ground - rooms floor and claimed ground. */ PwCast_EnemyGround = 0x0080, /** Allow casting the spell on neutral tall slabs - earth, wall, gold. */ PwCast_NeutrlWall = 0x0100, /** Allow casting the spell on owned tall slabs - own fortified wall. */ PwCast_OwnedWall = 0x0200, /** Allow casting the spell on tall slabs owned by allies - their fortified walls. */ PwCast_AlliedWall = 0x0400, /** Allow casting the spell on tall slabs owned by enemies - their fortified walls. */ PwCast_EnemyWall = 0x0800, /** Allow casting the spell on owned food things (chickens). */ PwCast_OwnedFood = 0x1000, /** Allow casting the spell on owned and neutral gold things (piles,pots etc.). */ PwCast_OwnedGold = 0x2000, /** Allow casting the spell on owned spellbooks. */ PwCast_OwnedSpell = 0x4000, /** There are no map-related conditions - allow casting the spell anywhere on map. */ PwCast_Anywhere = 0x8000, }; #define PwCast_AllCrtrs (PwCast_CustodyCrtrs|PwCast_OwnedCrtrs|PwCast_AlliedCrtrs|PwCast_EnemyCrtrs) #define PwCast_AllGround (PwCast_NeutrlGround|PwCast_OwnedGround|PwCast_AlliedGround|PwCast_EnemyGround) #define PwCast_AllWall (PwCast_NeutrlWall|PwCast_OwnedWall|PwCast_AlliedWall|PwCast_EnemyWall)
The "|" is used to merge values, so spell can be casted on both things.
Now, I used those values in spell information struct:
What I need is a confirmation that I used correct values for every spell.Code:struct SpellData spell_data[] = { {36, 11, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0}, //[0] None { 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, PwCast_OwnedCrtrs|PwCast_OwnedGround|PwCast_OwnedGold}, //[1] Power Hand {36, 24, 0, 95, 118, 631, 648, 831, 5, NULL, 0, PwCast_OwnedGround}, //[2] Make Digger {97, 0, 0, 394, 452, 636, 653, 834, 0, NULL, 0, PwCast_OwnedCrtrs}, //[3] Must Obey { 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, PwCast_OwnedCrtrs|PwCast_OwnedFood}, //[4] Slap {36, 8, 1, 85, 108, 632, 649, 828, 12, sight_of_evil_expand_check,0, PwCast_Anywhere}, //[5] Sight of Evil {36, 6, 1, 93, 116, 633, 650, 826, 0, call_to_arms_expand_check, 1, PwCast_AllGround}, //[6] Call To Arms {36, 7, 1, 97, 120, 635, 652, 837, 10, general_expand_check, 0, PwCast_AllGround}, //[7] Cave in {36, 22, 0, 87, 110, 644, 661, 829, 8, general_expand_check, 1, PwCast_OwnedCrtrs|PwCast_AlliedCrtrs}, //[8] Heal Creature {41, 0, 0, 89, 112, 634, 651, 830, 0, general_expand_check, 0, PwCast_Anywhere}, //[9] Hold Audience {36, 17, 0, 101, 124, 640, 657, 833, 6, general_expand_check, 1, PwCast_AllGround}, //[10] Lightning {36, 19, 0, 99, 122, 637, 654, 838, 11, general_expand_check, 1, PwCast_OwnedCrtrs|PwCast_AlliedCrtrs}, //[11] Speed Creature {36, 20, 0, 103, 126, 638, 655, 825, 9, general_expand_check, 1, PwCast_OwnedCrtrs}, //[12] Protect {36, 21, 0, 105, 128, 639, 656, 832, 1, general_expand_check, 1, PwCast_OwnedCrtrs}, //[13] Conceal {36, 26, 0, 310, 319, 642, 659, 835, 3, general_expand_check, 1, PwCast_EnemyCrtrs|PwCast_CustodyCrtrs}, //[14] Disease {36, 27, 0, 306, 314, 641, 658, 827, 2, general_expand_check, 1, PwCast_EnemyCrtrs|PwCast_CustodyCrtrs}, //[15] Chicken {36, 25, 0, 308, 317, 643, 660, 839, 4, general_expand_check, 0, PwCast_AllWall}, //[16] Destroy Walls {36, 28, 0, 105, 128, 645, 662, 0, 0, NULL, 0, PwCast_AllGround}, //[17] Time Bomb {36, 11, 0, 91, 114, 630, 647, 836, 7, NULL, 1, PwCast_OwnedCrtrs}, //[18] Possession {98, 0, 0, 312, 321, 646, 663, 824, 0, NULL, 0, PwCast_Anywhere}, //[19] Armageddon { 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0}, //[20] };
Let me know if you see any errors.