def test_adding_all_armor_types(): guard = ActorBuilder().build() guard.dexterity.value = 13 guard.natural_armor.value = 2 # got really thick skin guard.add_component(ChainMail()) guard.add_component(LightSteelShield()) assert guard.armor_class.value == 19
def test_grapple_attack(): guard = ActorBuilder().build() guard.attack.base.value += 3 guard.strength = 16 guard.configure("size", Size.LARGE) assert guard.size == Size.LARGE assert guard.attack.grapple.value == 10
def test_size_effects(): guard = ActorBuilder().build() guard.size = Size.LARGE assert guard.attack.base.value == -1 assert guard.armor_class.value == 9 guard.size = Size.MEDIUM assert guard.attack.base.value == 0 assert guard.armor_class.value == 10
def test_base_attack(): guard = ActorBuilder().build() guard.attack.base.value += 1 assert guard.attack.melee.value == 1 guard.strength = 15 guard.dexterity = 12 assert guard.attack.melee.value == 3 assert guard.attack.ranged.value == 2
def test_strength_affected(): guard = ActorBuilder().build() guard.configure("strength", 16) assert guard.strength.value == 16 assert guard.attack.melee.value == 3 guard.configure("strength", 12) assert guard.strength.value == 12 assert guard.attack.melee.value == 1
def test_only_armor_low_touch_armor_class(): guard = ActorBuilder().build() guard.add_component(ChainMail()) assert guard.armor_class.value == 15 assert guard.touch.value == 10 guard.dexterity.value = 14 assert guard.armor_class.value == 17 assert guard.touch.value == 12
def test_that_old_armor_bonus_gets_removed(): guard = ActorBuilder().build() heavy_shield = HeavySteelShield() guard.add_equipment(heavy_shield) assert guard.activate_equipment(heavy_shield.id) assert guard.armor_class.value == 12 light_shield = LightSteelShield() guard.add_equipment(light_shield) guard.deactivate_equipment(heavy_shield.id) assert guard.activate_equipment(light_shield.id) assert guard.armor_class.value == 11
def test_that_vital_objects_like_dexterity_can_not_be_destroyed(): guard = ActorBuilder().build() guard.dexterity = 12 assert guard.armor_class.value == 11 guard.remove_component("dexterity") assert guard.armor_class.value == 11 guard.registry.get("skill/jump").value = 5 guard.configure("skill/tumble", 5) guard.remove_component("skill/jump") assert guard.registry.get("skill/tumble").value == 8 assert guard.registry.has("skill/jump")
def test_wiring_skills(): tumble = Tumble(6) balance = Balance(0) character = ActorBuilder().build() character.add_component(balance) character.strength.value = 8 character.dexterity.value = 14 character.add_component(Jump(0)) character.add_component(tumble) assert tumble.bonus.value == 8 assert balance.value == 4
def test_adding_a_weapon(): guard = ActorBuilder().build() guard.strength.value = 16 guard.dexterity.value = 13 sword = Longsword() dagger = Dagger() guard.add_component(sword) guard.add_component(dagger) guard.add_component(WeaponFocus(sword)) assert sword.melee.attack.value == 4 assert sword.melee.damage.default == d8 assert sword.melee.damage.value == d8+3 assert dagger.melee.attack.value == 3 assert dagger.ranged.attack.value == 1 assert dagger.ranged.damage.value == d4
def test_dexterity_affected(): guard = ActorBuilder().build() guard.dexterity = 8 assert guard.armor_class.value == 9 assert guard.attack.ranged.value == -1 assert guard.reflex.value == -1
def test_adding_chainmail(): guard = ActorBuilder().build() guard.dexterity.value = 12 guard.add_component(ChainMail()) assert guard.armor_class.value == 16
def test_adding_shield(): guard = ActorBuilder().build() guard.add_component(LightSteelShield()) assert guard.armor_class.value == 11