public Buff(PrimaryAttributeName attr, BuffType type, float value) { this.attr = attr; this.type = type; attributeType = 1; valueOverLayer = new List <float>() { value }; }
public virtual void OnBuff(BaseCharacterBehavior character, BaseCharacterBehavior caster, bool stackable = false, float updateValue = 0) { if (stackable) { stack++; valueOverLayer.Add(updateValue); } else { stack = 1; if (updateValue != 0) { valueOverLayer[0] = updateValue; } } this.caster = caster; Ability attr = null; int mount; switch (attributeType) { case 1: attr = character.status.GetPrimaryAttrubute(this.attr); break; case 2: attr = character.status.GetSecondaryAttrubute(this.attr2); break; case 3: attr = character.status.GetConsumedAttrubute(this.attr3); break; case 4: attr = character.status.GetStaticAttribute(this.attr4); break; default: break; } mount = (int)(type == BuffType.Absolute ? valueOverLayer[stack - 1] : attr.baseValue * valueOverLayer[stack - 1]); attr.buffedValue += mount; if (onBuff != null) { onBuff(character); } }
public virtual void OnDeBuff(BaseCharacterBehavior character) { int mount; Ability attr = null; switch (attributeType) { case 1: attr = character.status.GetPrimaryAttrubute(this.attr); break; case 2: attr = character.status.GetSecondaryAttrubute(this.attr2); break; case 3: attr = character.status.GetConsumedAttrubute(this.attr3); break; case 4: attr = character.status.GetStaticAttribute(this.attr4); break; default: break; } foreach (float value in valueOverLayer) { mount = (int)(type == BuffType.Absolute ? value : attr.baseValue * value) * -1; attr.buffedValue += mount; } if (endBuff != null) { endBuff(character); } }
public static Texture2D GetBuffIcon(PrimaryAttributeName name) { switch (name) { case PrimaryAttributeName.Power: return(Resources.Load(iconPath + "icon_64x64_23") as Texture2D); case PrimaryAttributeName.Agility: return(Resources.Load(iconPath + "icon_64x64_54") as Texture2D); case PrimaryAttributeName.Wisdom: return(Resources.Load(iconPath + "icon_64x64_21") as Texture2D); case PrimaryAttributeName.Constitution: return(Resources.Load(iconPath + "icon_64x64_56") as Texture2D); case PrimaryAttributeName.Luck: return(Resources.Load(iconPath + "icon_64x64_87") as Texture2D); default: return(Resources.Load(iconPath + "icon_64x64_151") as Texture2D); } }
public PrimaryAttribute(PrimaryAttributeName name) : base(name.ToString()) { this.name = name; }
public PrimaryAttribute(PrimaryAttributeName name, int value, int buffedValue, int exp, int expToLevelUp) : base(name.ToString(), value, buffedValue, exp, expToLevelUp) { this.name = name; }
public PrimaryAttribute GetPrimaryAttrubute(PrimaryAttributeName name) { return(priAttributes[(int)name]); }