예제 #1
0
    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();
    }
예제 #2
0
    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);
    }
예제 #3
0
    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);
    }
예제 #4
0
 public override bool CanEffect(Entity entity)
 {
     return(StatModifierUtil.CanApplyStatModifier(entity, modifier));
 }
예제 #5
0
 public override void Exit(Entity entity)
 {
     StatModifierUtil.RemoveStatModifier(entity, modifier);
 }
예제 #6
0
 public override void Enter(Entity entity)
 {
     StatModifierUtil.ApplyStatModifier(entity, modifier);
 }