public void EquipArmor(Armor armor) { Debug.Assert(armor != null, "EquipArmor: Armor parameter cannot be null."); Debug.Assert(equippedArmor[(int)armor.ArmorType] == null, $"EquipArmor: Trying to equip armor{armor.ArmorType} before unequipping current armor{armor.ArmorType}."); equippedArmor[(int)armor.ArmorType] = armor; self.Stats.Augments.Defense += armor.Defense; StatModifierUtil.ApplyStatModifiers(self, armor.Modifiers); self.OnUpdateStats(); }
public Armor UnEquipArmor(ArmorType type) { Armor armor = equippedArmor[(int)type]; if (armor != null) { self.Stats.Augments.Defense -= armor.Defense; StatModifierUtil.RemoveStatModifiers(self, armor.Modifiers); self.OnUpdateStats(); } equippedArmor[(int)type] = null; return(armor); }
public bool UseConsumable(Consumable consumable) { bool result = false; StatModifierEffect modifierEffect = consumable.ModifierEffect; StatModifier modifier = consumable.Modifier; if (modifierEffect != null && StatModifierUtil.CanApplyStatModifier(self, modifierEffect.Modifier)) { self.AddStatusEffect(modifierEffect); result = true; } if (modifier != null && StatModifierUtil.CanApplyStatModifier(self, modifier)) { StatModifierUtil.ApplyStatModifier(self, modifier); result = true; } return(result); }
public override bool CanEffect(Entity entity) { return(StatModifierUtil.CanApplyStatModifier(entity, modifier)); }
public override void Exit(Entity entity) { StatModifierUtil.RemoveStatModifier(entity, modifier); }
public override void Enter(Entity entity) { StatModifierUtil.ApplyStatModifier(entity, modifier); }