tdBattlePetScript icon indicating copy to clipboard operation
tdBattlePetScript copied to clipboard

conditions: fix issue 26 / handling of non-existent pets/abilities

Open bloerwald opened this issue 5 years ago • 0 comments

Assumes

test(expected: self(pet).dead) [ !self(pet).dead ]
test(expected: self(pet).hp == 0) [ self(pet).hp != 0 ]
test(expected: !self(pet).hp.full) [ self(pet).hp.full ]
test(expected: !self(pet).hp.can_explode) [ self(pet).hp.can_explode ]
-- no pet, no arg: hp.low
-- no pet, no arg: hp.high
test(expected: self(pet).hpp == 0) [ self(pet).hpp != 0 ]
test(expected: !self.aura(arg).exists) [ self.aura(arg).exists ]
test(expected: !self(#1).aura(arg).exists) [ self(#1).aura(arg).exists ]
test(expected: !self(pet).aura(arg).exists) [ self(pet).aura(arg).exists ]
test(expected: self.aura(arg).duration == 0) [ self.aura(arg).duration != 0 ]
test(expected: self(#1).aura(arg).duration == 0) [ self(#1).aura(arg).duration != 0 ]
test(expected: self(pet).aura(arg).duration == 0) [ self(pet).aura(arg).duration != 0 ]
test(expected: !weather(arg)) [ weather(arg) ]
test(expected: weather(arg).duration == 0) [ weather(arg).duration != 0 ]
test(expected: !self(pet).active) [ self(pet).active ]
test(expected: !self.ability(arg).usable) [ self.ability(arg).usable ]
test(expected: !self(#1).ability(arg).usable) [ self(#1).ability(arg).usable ]
test(expected: !self(pet).ability(arg).usable) [ self(pet).ability(arg).usable ]
test(expected: self.ability(arg).duration == inf) [ self.ability(arg).duration < 1000000 ]
test(expected: self(#1).ability(arg).duration == inf) [ self(#1).ability(arg).duration < 1000000 ]
test(expected: self(pet).ability(arg).duration == inf) [ self(pet).ability(arg).duration < 1000000 ]
test(expected: !self.ability(arg).strong) [ self.ability(arg).strong ]
test(expected: !self(#1).ability(arg).strong) [ self(#1).ability(arg).strong ]
test(expected: !self(pet).ability(arg).strong) [ self(pet).ability(arg).strong ]
test(expected: !self.ability(arg).weak) [ self.ability(arg).weak ]
test(expected: !self(#1).ability(arg).weak) [ self(#1).ability(arg).weak ]
test(expected: !self(pet).ability(arg).weak) [ self(pet).ability(arg).weak ]
test(expected: self.ability(arg).type !~ 1,2,3,4,5,6,7,8,9,10) [ self.ability(arg).type ~ 1,2,3,4,5,6,7,8,9,10 ]
test(expected: self(#1).ability(arg).type !~ 1,2,3,4,5,6,7,8,9,10) [ self(#1).ability(arg).type ~ 1,2,3,4,5,6,7,8,9,10 ]
test(expected: self(pet).ability(arg).type !~ 1,2,3,4,5,6,7,8,9,10) [ self(pet).ability(arg).type ~ 1,2,3,4,5,6,7,8,9,10 ]
-- no pet, no arg: round
test(expected: !self(pet).played) [ self(pet).played ]
test(expected: self(pet).speed == 0) [ self(pet).speed != 0 ]
test(expected: self(pet).power == 0) [ self(pet).power != 0 ]
test(expected: self(pet).level == 0) [ self(pet).level != 0 ]
test(expected: !self(pet).level.max) [ self(pet).level.max ]
-- no pet, no arg: speed.fast
-- no pet, no arg: speed.slow
test(expected: self(pet).type !~ 1,2,3,4,5,6,7,8,9,10) [ self(pet).type ~ 1,2,3,4,5,6,7,8,9,10 ]
test(expected: self(pet).quality !~ 1,2,3,4,5,6) [ self(pet).quality ~ 1,2,3,4,5,6 ]
test(expected: !self(pet).exists) [ self(pet).exists ]
test(expected: !self(pet).is(other)) [ self(pet).is(other) ]
test(expected: !self(pet).is(#1)) [ self(pet).is(#1) ]
test(expected: !self(#1).is(other)) [ self(#1).is(other) ]
test(expected: self(pet).id == 0) [ self(pet).id != 0 ]
test(passed)

to be the expected behavior and ensures that.

Note: previously,

  • !self(pet).dead
  • self.hp and self.hpp is not 0
  • self(pet).aura(arg).duration is not 0
  • lua error because self.ability(arg).duration < 1000000 is breaking (the issue)
  • lua error because self.ability(arg).type !~ 1,2,3,4,5,6,7,8,9,10) is broken (the same reason)
  • lua error because self(pet).type ~ 1,2,3,4,5,6,7,8,9,10 is broken (same reason, again)

bloerwald avatar Dec 14 '20 21:12 bloerwald