Can't find bug location in code :P
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- ChaosRider
- Posts: 846
- Joined: April 15th, 2012, 1:15 pm
Can't find bug location in code :P
I have item which is adding to unit weapons one of 40 weapon specials (for each weapon its picking value of added weapon special). Before its add any weapon special its checking is unit on this one weapon have any weapon specials from these 40 types - everytime its find weapon special its increase value of variable which is describes how much weapon specials unit have on this one weapon. Weapon can have max 3 weapon specials from this weapon specials list, to add any new weapon special it can have max 2 already existing weapon specials.
Macro (magical and marksman require to create new variables thx which we can later know to not add other (weaker in chance to hit) weapon special (we wont add marksman if unit have already magical):
List of checked weapon specials
Switch with 40 cases:
This switch is inside {FOREACH unit.attack j} and {NEXT j}
Wierd situations with code:
- sometimes (not allways) units can get another weapon specials when they have already 3
- sometimes (not with each new selected weapon special) other earlier existing weapon specials on unit weapon are deleted
- not allways code see weapon special on weapon, for example if weapon has 1-2 weapon specials then it can see both of it, when it has 3 then it cant see one of 2 earlier existing.
I couldnt find location of bug so this is why Im posting here on forum .
Macro (magical and marksman require to create new variables thx which we can later know to not add other (weaker in chance to hit) weapon special (we wont add marksman if unit have already magical):
Code: Select all
#define BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON TAGS NAME
[if]
[variable]
name=unit.attack[$j].specials.{TAGS}.id
equals={NAME}
[/variable]
[then]
{VARIABLE_OP bdal_amount_of_weapon_specials add 1}
{VARIABLE temp_special_tags {TAGS}}
{VARIABLE temp_special_id {NAME}}
[if]
[variable]
name=temp_special_tags
equals=chance_to_hit
[/variable]
[and]
[variable]
name=temp_special_id
equals=magical
[/variable]
[/and]
[then]
{VARIABLE bdal_has_magical yes}
[/then]
[/if]
[if]
[variable]
name=temp_special_tags
equals=chance_to_hit
[/variable]
[and]
[variable]
name=temp_special_id
equals=marksman
[/variable]
[/and]
[then]
{VARIABLE bdal_has_marksman yes}
[/then]
[/if]
{CLEAR_VARIABLE temp_special_tags,temp_special_id}
[message]
speaker=unit
message="Found $unit.attack[$j].name {TAGS} {NAME}"
[/message]
[/then]
[else]
[/else]
[/if]
#enddef
Code: Select all
{VARIABLE_OP bdal_amount_of_weapon_specials value 0}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage evasion}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON berserk duel3}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON chance_to_hit struggle}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage horror}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage bloody}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage "elven_enemy"}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON attacks ramming}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON dummy thunderbolt}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage focus}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON berserk duel2}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage drakes_hunter}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage monster_hunter}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage orcs_hunter}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage dwarves_tamer}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage holy}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage charge}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON attacks mad_gunfire}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON attacks angelic_curse}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON poison poison}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON chance_to_hit marksman}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON firststrike firststrike}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON slow slow}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON chance_to_hit cyclops_luck}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage offensive_gains}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage backstab}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage pierce}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage greater_pierce}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage legendary_pierce}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON chance_to_hit magical}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON chance_to_hit spinning}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON chance_to_hit clumsy}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON berserk duel_defense_2}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage lizards_absorber}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage goblins_killer}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage trollslayer}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage ogres_represser}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage trees_destroyer}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage nagas_murderer}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage exterminator_of_sirens}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON damage gryphons_devourer}
{BDAL_COUNT_WEAPON_SPECIALS_ON_WEAPON berserk berserk}
Code: Select all
[if]
[variable]
name=bdal_amount_of_weapon_specials
less_than=3
[/variable]
[then]
{VARIABLE_OP temp_rand rand 1..40}
[message]
speaker=unit
message="picked value of added weapon special is $temp_rand."
[/message]
[switch]
variable=temp_rand
[case]
value=1
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=evasion
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=evasion
name= _ "evasion"
name_inactive= _ "evasion"
description= _ "When this attack is used offensively, this unit takes one third less damage in retaliation."
active_on=offense
apply_to=opponent
multiply=0.66
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=2
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=duel3
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[berserk]
id=duel3
name= _ "duel 3"
description= _ "Whether used offensively or defensively, this attack presses the engagement until one of the combatants is slain, or 3 rounds of attacks have occurred."
value=3
active_on=offense
[/berserk]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=3
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=struggle
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[chance_to_hit]
id=struggle
sub=10
apply_to=opponent
cumulative=yes
[/chance_to_hit]
[chance_to_hit]
id=struggle
name= _ "struggle"
description= _ "This attack causes the opponent to have a 10% lower chance to hit."
apply_to=self
cumulative=yes
[/chance_to_hit]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=4
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=horror
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=horror
multiply=0.7
apply_to=defender
active_on=offense
[/damage]
[damage]
id=horror
name= _ "horror"
description= _ "When this unit is attacking, the defender's damage is reduced by 30%."
multiply=1
apply_to=attacker
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=5
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=bloody
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=bloody
multiply=1.5
apply_to=self
[filter_opponent]
race=human
[/filter_opponent]
[/damage]
[damage]
id=bloody
name= _ "bloody"
description= _ "This attack deals 50% extra damage to human."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=6
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=elven_enemy
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=elven_enemy
multiply=1.5
apply_to=self
[filter_opponent]
race=elf
[/filter_opponent]
[/damage]
[damage]
id=elven_enemy
name= _ "elven enemy"
description= _ "This attack deals 50% extra damage to elves."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=7
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=ramming
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[attacks]
id=ramming
name= _ "ramming"
description= _ "When used offensively, this attack gets 1 more strikes but have decreased chance to hit by 10%."
add=1
apply_to=self
active_on=offense
[/attacks]
[chance_to_hit]
id=ramming
sub=10
apply_to=self
cumulative=yes
active_on=offense
[/chance_to_hit]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=8
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=thunderbolt
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[dummy]
id=thunderbolt
name= _ "thunderbolt"
description=_ "Every time this unit attacks with this weapon there is a 15% chance the weapon will call down a thunderbolt from the sky. The thunderbolt deals from 1 to 30 arcane damage to the opponent before the attack begins. Thunderbolts can kill enemy."
[/dummy]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=9
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=focus
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=focus
name= _ "focus"
description= _ "When used offensively, this attack deals x1.5 damage more to the target. It also causes this unit to take x1.5 damage more from the target's counterattack."
multiply=1.5
apply_to=both
active_on=offense
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=10
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=duel2
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[berserk]
id=duel2
name= _ "duel 2"
description= _ "Whether used offensively or defensively, this attack presses the engagement until one of the combatants is slain, or 2 rounds of attacks have occurred."
value=2
active_on=offense
[/berserk]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=11
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=drakes_hunter
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=drakes_hunter
multiply=1.5
apply_to=self
[filter_opponent]
race=drake
[/filter_opponent]
[/damage]
[damage]
id=drakes_hunter
name= _ "drakes hunter"
description= _ "This attack deals 50% extra damage to drakes."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=12
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=monster_hunter
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=monster_hunter
multiply=1.5
apply_to=self
[filter_opponent]
race=monster
[/filter_opponent]
[/damage]
[damage]
id=monster_hunter
name= _ "monster hunter"
description= _ "This attack deals 50% extra damage to monsters."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=13
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=orcs_hunter
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=orcs_hunter
multiply=1.5
apply_to=self
[filter_opponent]
race=orc
[/filter_opponent]
[/damage]
[damage]
id=orcs_hunter
name= _ "orcs hunter"
description= _ "This attack deals 50% extra damage to orcs."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=14
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=dwarves_tamer
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=dwarves_tamer
multiply=1.5
apply_to=self
[filter_opponent]
race=dwarf
[/filter_opponent]
[/damage]
[damage]
id=dwarves_tamer
name= _ "dwarves tamer"
description= _ "This attack deals 50% extra damage to dwarves."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=15
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=holy
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=holy
multiply=1.5
apply_to=self
[filter_opponent]
race=undead
[/filter_opponent]
[/damage]
[damage]
id=holy
name= _ "holy"
description= _ "This attack deals 50% extra damage to undead."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=16
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=charge
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
{WEAPON_SPECIAL_CHARGE}
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=17
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=mad_gunfire
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[attacks]
id=mad_gunfire
name= _ "mad gunfire"
description= _ "When used offensively, this attack gets 50% more strikes but have decreased chance to hit by 10%."
multiply=1.5
apply_to=self
active_on=offense
[/attacks]
[chance_to_hit]
id=mad_gunfire
sub=10
apply_to=self
cumulative=yes
active_on=offense
[/chance_to_hit]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=18
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=angelic_curse
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[attacks]
id=angelic_curse
sub=1
apply_to=opponent
active_on=offense
[/attacks]
[attacks]
id=angelic_curse
name= _ "angelic curse"
description= _ "This weapon decrease enemies strikes by 1 in offense."
apply_to=self
cumulative=yes
[/attacks]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=19
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=poison
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
{WEAPON_SPECIAL_POISON}
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=20
[if]
[variable]
name=bdal_has_magical
not_equals=yes
[/variable]
[then]
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=cyclops_luck
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=marksman
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
{WEAPON_SPECIAL_MARKSMAN}
[/set_specials]
[/effect]
[/object]
[/then]
[/if]
[/case]
[case]
value=21
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=firststrike
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
{WEAPON_SPECIAL_FIRSTSTRIKE}
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=22
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=slow
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
{WEAPON_SPECIAL_SLOW}
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=23
[if]
[variable]
name=bdal_has_marksman
not_equals=yes
[/variable]
[and]
[variable]
name=bdal_has_magical
not_equals=yes
[/variable]
[/and]
[then]
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=cyclops_luck
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[chance_to_hit]
id=cyclops_luck
name= _ "cyclops luck"
description= _ "When used offensively, this attack always has at least a 40% chance to hit."
value=40
cumulative=yes
active_on=offense
[/chance_to_hit]
[/set_specials]
[/effect]
[/object]
[/then]
[/if]
[/case]
[case]
value=24
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=offensive_gains
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=offensive_gains
name= _ "brutality"
name_inactive= _ "brutality"
description= _ "When this attack is used in offense the unit deals 25% more damage and takes 25% more damage."
active_on=offense
apply_to=both
multiply=1.25
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=25
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=backstab
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
{WEAPON_SPECIAL_BACKSTAB}
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=26
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=pierce
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=pierce
name= _ "pierce"
description= _ "If this attack is used, the enemy behind the target is hurt as well, for 1/2 of the damage."
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=27
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=greater_pierce
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=greater_pierce
name= _ "greater pierce"
description= _ "If this attack is used, the enemies behind the target is hurt as well, for 1/2 of the damage for first enemy and next one enemy gets 1/4 of the damage."
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=28
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=legendary_pierce
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=legendary_pierce
name= _ "legendary pierce"
description= _ "If this attack is used, five enemies behind the target is hurt as well, their taken dmg depence of their distance. First enemy takes 1/2 of the dmg, next one 1/4, another one 1/7, fourth enemy takes 1/11 and last one fifth will get 1/16 of the dmg."
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=29
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=cyclops_luck
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=marksman
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=magical
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
{WEAPON_SPECIAL_MAGICAL}
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=30
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=spinning
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[chance_to_hit]
id=spinning
name= _ "spinning"
name_inactive= _ "spinning"
description= _ "Due to the dificulty of dodging or blocking a horizontally spinning weapon, this weapon has a +10% chance to hit."
apply_to=self
add=10
[/chance_to_hit]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=31
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=clumsy
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[chance_to_hit]
id=clumsy
sub=10
apply_to=self
cumulative=yes
[/chance_to_hit]
[chance_to_hit]
id=clumsy
name= _ "clumsy"
description= _ "You are so clumsy using this attack so it causes you to have a 10% lower chance to hit."
apply_to=self
cumulative=yes
[/chance_to_hit]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=32
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=duel_defense_2
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[berserk]
id=duel_defense_2
value=2
active_on=defense
[/berserk]
[berserk]
id=duel_defense_2
name= _ "duel defense 2"
description= _ "Whether used defensively, this attack presses the engagement until one of the combatants is slain, or 2 rounds of attacks have occurred."
value=1
[/berserk]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=33
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=lizards_absorber
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
[damage]
id=lizards_absorber
multiply=1.5
apply_to=self
[filter_opponent]
race=lizard
[/filter_opponent]
[/damage]
[damage]
id=lizards_absorber
name= _ "lizards absorber"
description= _ "This attack deals 50% extra damage to lizards."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=34
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=goblins_killer
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=goblins_killer
multiply=1.5
apply_to=self
[filter_opponent]
race=goblin
[/filter_opponent]
[/damage]
[damage]
id=goblins_killer
name= _ "goblins killer"
description= _ "This attack deals 50% extra damage to goblins."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=35
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=trollslayer
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=trollslayer
multiply=1.5
apply_to=self
[filter_opponent]
race=troll
[/filter_opponent]
[/damage]
[damage]
id=trollslayer
name= _ "trollslayer"
description= _ "This attack deals 50% extra damage to trolls."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=36
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=ogres_represser
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=ogres_represser
multiply=1.5
apply_to=self
[filter_opponent]
race=ogre
[/filter_opponent]
[/damage]
[damage]
id=ogres_represser
name= _ "ogres represser"
description= _ "This attack deals 50% extra damage to ogres."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=37
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=trees_destroyer
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=trees_destroyer
multiply=1.5
apply_to=self
[filter_opponent]
race=wose
[/filter_opponent]
[/damage]
[damage]
id=trees_destroyer
name= _ "trees destroyer"
description= _ "This attack deals 50% extra damage to woses."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=38
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=nagas_murderer
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=nagas_murderer
multiply=1.5
apply_to=self
[filter_opponent]
race=naga
[/filter_opponent]
[/damage]
[damage]
id=nagas_murderer
name= _ "nagas murderer"
description= _ "This attack deals 50% extra damage to nagas."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=39
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=exterminator_of_sirens
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=exterminator_of_sirens
multiply=1.5
apply_to=self
[filter_opponent]
race=merman
[/filter_opponent]
[/damage]
[damage]
id=exterminator_of_sirens
name= _ "exterminator of sirens"
description= _ "This attack deals 50% extra damage to mermans."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[case]
value=40
[object]
silent=yes
duration=forever
[filter]
id=$unit.id
[/filter]
[effect]
apply_to=attack
name=$unit.attack[$j].name
remove_specials=gryphons_devourer
[/effect]
[effect]
apply_to=attack
name=$unit.attack[$j].name
[set_specials]
mode=append
[damage]
id=gryphons_devourer
multiply=1.5
apply_to=self
[filter_opponent]
race=gryphon
[/filter_opponent]
[/damage]
[damage]
id=gryphons_devourer
name= _ "gryphons devourer"
description= _ "This attack deals 50% extra damage to gryphons."
multiply=1.0
[/damage]
[/set_specials]
[/effect]
[/object]
[/case]
[/switch]
{CLEAR_VARIABLE temp_rand}
Wierd situations with code:
- sometimes (not allways) units can get another weapon specials when they have already 3
- sometimes (not with each new selected weapon special) other earlier existing weapon specials on unit weapon are deleted
- not allways code see weapon special on weapon, for example if weapon has 1-2 weapon specials then it can see both of it, when it has 3 then it cant see one of 2 earlier existing.
I couldnt find location of bug so this is why Im posting here on forum .
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Re: Can't find bug location in code :P
I dont think I can help you, that is a scary big bunch of code, and basically your request is: "read whole it and find mistakes".
However, I think you could skip exception for stacking marksman and magical specials: If a unit with magical gets marksman later, I think unit wont be losing anything, as chance to hit will be set at 30 and then marksman will take that value over 40. If a unit with marksman gets magical later, will lose chance to hit on units under 30 defense (quite rare) but will be gaining chance to hit on defense for lot of cases (wich I think is a fair upgrade for unit). Overall I think doesnt worth code exception for such small difference.
However, I think you could skip exception for stacking marksman and magical specials: If a unit with magical gets marksman later, I think unit wont be losing anything, as chance to hit will be set at 30 and then marksman will take that value over 40. If a unit with marksman gets magical later, will lose chance to hit on units under 30 defense (quite rare) but will be gaining chance to hit on defense for lot of cases (wich I think is a fair upgrade for unit). Overall I think doesnt worth code exception for such small difference.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
- ChaosRider
- Posts: 846
- Joined: April 15th, 2012, 1:15 pm
Re: Can't find bug location in code :P
It's look kinda bad when unit has marksman and magical ...tekelili wrote:I dont think I can help you, that is a scary big bunch of code, and basically your request is: "read whole it and find mistakes".
However, I think you could skip exception for stacking marksman and magical specials: If a unit with magical gets marksman later, I think unit wont be losing anything, as chance to hit will be set at 30 and then marksman will take that value over 40. If a unit with marksman gets magical later, will lose chance to hit on units under 30 defense (quite rare) but will be gaining chance to hit on defense for lot of cases (wich I think is a fair upgrade for unit). Overall I think doesnt worth code exception for such small difference.
To my topic, I think I found the reason of bug finally, "mode=append" if this thing is not added in set_specials tags then its as in default so its set to replace weapons specials... not all options in cases had it.
So this solve problem with dissapearing weapon specials but I still don't know why sometimes its doesnt see some weapon specials thx what you can have more than 3 weapon specials of these 40 (which is not planned)...
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.