private void OnActorAttacked(TriggerBuff buff, BuffTriggerType trigger, object token) { System.Collections.Generic.IEnumerable <StatBuff> source = buff.Target.GetBuffs((Buff entry) => entry.Spell == base.Spell).OfType <StatBuff>(); int num = ( from entry in source where (int)entry.Duration == this.Effect.Duration select entry).Sum((StatBuff entry) => (int)entry.Value); short diceFace = base.Dice.DiceFace; if (num < (int)diceFace) { Fights.Damage damage = (Fights.Damage)token; int num2 = damage.Amount; if (num2 + num > (int)diceFace) { num2 = (int)((short)((int)diceFace - num)); } PlayerFields punishmentBoostType = Punishment.GetPunishmentBoostType(base.Dice.DiceNum); StatBuff buff2 = new StatBuff(buff.Target.PopNextBuffId(), buff.Target, base.Caster, base.Dice, base.Spell, (short)num2, punishmentBoostType, false, true, (short)Punishment.GetBuffEffectId(punishmentBoostType)) { Duration = base.Dice.Value }; buff.Target.AddAndApplyBuff(buff2, true); } }
private bool OnActorAttacked(TriggerBuff buff, TriggerType trigger, object token) { IEnumerable <StatBuff> source = buff.Target.GetBuffs <StatBuff>(x => x.SpellId == this.SpellId); int num = ( from entry in source where (int)entry.Duration == this.Effect.Duration select entry).Sum((StatBuff entry) => (int)entry.Value); short diceFace = (short)Effect.DiceMax; if (num < (int)diceFace) { Damage damage = (Damage)token; int num2 = damage.Delta; if (num2 + num > (int)diceFace) { num2 = (int)((short)((int)diceFace - num)); } Characteristic characteristic = GetPunishementCharacteristic(buff.Target, Effect.DiceMin); StatBuff buff2 = new StatBuff(buff.Target.BuffIdProvider.Pop(), buff.Target, Source, SpellLevel, Effect, this.SpellId, (short)num2, characteristic, false, FightDispellableEnum.REALLY_NOT_DISPELLABLE, (short)GetPunishementEffectEnum(Effect.DiceMin)) { Duration = (short)Effect.Value, }; buff.Target.AddAndApplyBuff(buff2, true); } return(false); }
public override BuffEffect Copy() { StatBuff sb = new StatBuff(containerType, reverseChange_on_removal); sb.sc = (StatsContainer)sc.Copy(); return(sb); }
public override void RemoveBuff(StatBuff buff) { base.RemoveBuff(buff); if (current > value) { current = value; } }
public virtual void RemoveBuff(StatBuff buff) { if (buffs.Contains(buff)) { buff_value -= buff.buff_value; buffs.Remove(buff); } }
public override void RemoveBuff(StatBuff buff) { buff_value -= buff.buff_value; if (current_value > value) { current_value = value; } }
public StatBuff AddStatBuff(FightActor target, short value, PlayerFields caracteritic, bool dispelable, CustomActionsEnum customAction) { int id = target.PopNextBuffId(); StatBuff statBuff = new StatBuff(id, target, this.Caster, this.Effect, this.Spell, value, caracteritic, this.Critical, dispelable, (short)customAction); target.AddAndApplyBuff(statBuff, true); return(statBuff); }
public StatBuff AddStatBuff(Fighter target, short value, Characteristic caracteritic, FightDispellableEnum dispelable) { int id = target.BuffIdProvider.Pop(); StatBuff statBuff = new StatBuff(id, target, this.Source, this.SpellLevel, this.Effect, this.SpellId, value, caracteritic, this.Critical, dispelable); target.AddAndApplyBuff(statBuff, true); return(statBuff); }
public void Start() { WaterToActivateAtRuntime.SetActive(true); movestatbuff = new StatBuff(Stats.StatType.GROUND_SPEED, waterResistance, -1, "water_move_debuff"); dashstatbuff = new StatBuff(Stats.StatType.DASH_FORCE, waterResistance, -1, "water_dash_debuff"); jumpstatbuff = new StatBuff(Stats.StatType.JUMP_HEIGHT, waterResistance, -1, "water_jump_debuff"); }
public static void WaterResistPercent(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List<Fighter> affecteds, short castcellid) { foreach (var target in affecteds) { var statdefinition = new UInt16ReflectedStat(StatsRecord.GetFieldInfo("WaterResistPercent"), fighter.FighterStats.Stats); StatBuff buff = new StatBuff((uint)target.BuffIdProvider.Pop(), statdefinition, (uint)effect.BaseEffect.EffectType, effect.BaseEffect.DiceNum, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.DiceNum, effect.BaseEffect.Delay); target.AddBuff(buff); } }
public static void EarthResistPercent(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List <Fighter> affecteds, short castcellid) { foreach (var target in affecteds) { var statdefinition = new UInt16ReflectedStat(StatsRecord.GetFieldInfo("EarthResistPercent"), fighter.FighterStats.Stats); StatBuff buff = new StatBuff((uint)target.BuffIdProvider.Pop(), statdefinition, (uint)effect.BaseEffect.EffectType, effect.BaseEffect.DiceNum, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.DiceNum, effect.BaseEffect.Delay); target.AddBuff(buff); } }
public void RemoveBuff(StatBuff buff) { StatType stat = buff.StatType; buffList.Remove(buff); UpdateStat(stat); #if UNITY_EDITOR //Debug.Log("Buff Removed"); #endif }
private void LevelUp() { Level++; m_ExpToNextLevel = (5f * (float)Math.Pow((double)Level, 2d)) + 95f; StatBuff t = new StatBuff(); t.Visible = true; t.Activate(); OnLevelUp.Invoke(); Health = MaxHealth; }
public static void BuffHandler(TriggerBuff buff, BuffTriggerType type, object token) { EffectInteger effectInteger = buff.GenerateEffect(); if (!(effectInteger == null)) { int id = buff.Target.PopNextBuffId(); StatBuff statBuff = new StatBuff(id, buff.Target, buff.Caster, buff.Effect, buff.Spell, effectInteger.Value, PlayerFields.AP, false, false); buff.Target.AddAndApplyBuff(statBuff, true); } }
public override void ApplyBuff(StatBuff buff) { base.ApplyBuff(buff); if (buff.buff_value > 0) { current_value += buff_value; } else if (current_value > value) { current_value = value; } }
virtual public Stat calculateBaseStat(StatTypes statType) { if (!hasStat(statType)) { return(null); } float value = 0; int? minMax = null; int? maxMin = null; Stat objStat = stats.Find(x => x.statType == statType); if (objStat != null) { value = objStat.Value; minMax = objStat.MaxValue; maxMin = objStat.MinValue; } foreach (Buff buff in buffs) { StatBuff statBuff = buff.getStat(statType); if (statBuff != null && statBuff.BuffType == BuffTypes.Additive) { value += statBuff.Value; if (minMax == null || statBuff.MaxValue != null && statBuff.MaxValue < minMax) { minMax = statBuff.MaxValue; } if (maxMin == null || statBuff.MinValue != null && statBuff.MinValue > maxMin) { maxMin = statBuff.MinValue; } } } foreach (Buff buff in buffs) { StatBuff statBuff = buff.getStat(statType); if (statBuff != null && statBuff.BuffType == BuffTypes.Multiplicative) { value *= statBuff.Value; if (minMax == null || statBuff.MaxValue != null && statBuff.MaxValue < minMax) { minMax = statBuff.MaxValue; } if (maxMin == null || statBuff.MinValue != null && statBuff.MinValue > maxMin) { maxMin = statBuff.MinValue; } } } return(new Stat(value, statType, minMax, maxMin)); }
public void Update() { if (buffList != null) { for (int i = 0; i < buffList.Count; i++) { StatBuff buff = buffList[i]; float timer = buff.UpdateTimer(); if (timer != -1 && timer < 0) { RemoveBuff(buff); } } } }
public override void AddSetBuff(StatBuff buff) { int difference = value - current_value; base.AddSetBuff(buff); if (current_value > value) { current_value = value; } // If the difference between the new values are larger make the difference equal to the old difference if (value - current_value > difference) { current_value = value - difference; } }
public override void AddBuff(StatBuff buff) { float value_before = value; base.AddBuff(buff); float value_after = value; if (value_before < value_after) { current += value_after - value_before; } if (current > value) { current = value; } }
protected Buff AddStatBuffDirectly(FightActor target, short value, PlayerFields caracteritic, short?customActionId = null, bool noDelay = false, FightActor triggerrer = null) { var id = target.PopNextBuffId(); var buff = new StatBuff(id, target, Caster, this, Spell, value, caracteritic, Critical, DefaultDispellableStatus, triggerrer); if (customActionId != null) { buff.CustomActionId = customActionId; } if (noDelay) { buff.Delay = 0; } target.AddBuff(buff); return(buff); }
public void DisplayUpgradeInfo(StatBuff statBuff) { //Create a new string builder StringBuilder builder = new StringBuilder(); //Get the colored text of the item builder.Append("<size=35>").Append("Blessing of ").Append(statBuff.StatType.ToString()).Append("</size>\n"); builder.Append(statBuff.GetUpgradeInfo()).AppendLine(); //Set the text based on the built text infoText.text = builder.ToString(); //Activate the popup object popupCanvasObject.SetActive(true); //Rebuild the layout of the window LayoutRebuilder.ForceRebuildLayoutImmediate(popupObject); }
void OnActorAttacked(TriggerBuff buff, FightActor triggerer, BuffTriggerType trigger, object token) { var currentBonus = m_buffs.Where(entry => entry.Item2.Target == buff.Target && entry.Item1 == Fight.TimeLine.RoundNumber).Sum(entry => entry.Item2.Value); var limit = Dice.DiceFace; // limit reached if (currentBonus >= limit) { return; } var damages = (Fights.Damage)token; var bonus = damages.Amount; if (bonus + currentBonus > limit) { bonus = (short)(limit - currentBonus); } if (bonus <= 0) { return; } var caracteristic = GetPunishmentBoostType(Dice.DiceNum); var statBuff = new StatBuff(buff.Target.PopNextBuffId(), buff.Target, Caster, this, Spell, (short)bonus, caracteristic, false, FightDispellableEnum.DISPELLABLE, triggerer) { Duration = Dice.Value, CustomActionId = Dice.DiceNum }; m_buffs.Add(new Tuple <int, StatBuff>(Fight.TimeLine.RoundNumber, statBuff)); if (caracteristic == PlayerFields.Health) { buff.Target.Heal(bonus, Caster, true); return; } buff.Target.AddBuff(statBuff, true); }
//Function to add a permaanent stat upgrade public void UpgradeStat(StatBuff newUpgrade) { //Get the stat modifier StatModifier newStatMod = newUpgrade.GetBuffModifier(); switch (newUpgrade.StatType) { case StatType.MaxHealth: //Add the modifier to health maxHealth.AddModifier(newStatMod); //Update the health UI setMaxHealthEvent.Raise((int)maxHealth.Value); break; case StatType.MaxMana: //Add the modifier to mana maxMana.AddModifier(newStatMod); //Update the mana UI setMaxManaEvent.Raise((int)maxMana.Value); break; case StatType.ManaRegen: //Add the modifier to mana regen manaRegen.AddModifier(newStatMod); break; case StatType.Strength: //Add the modifier to strength strength.AddModifier(newStatMod); break; case StatType.Speed: //Add the modifier to speed speed.AddModifier(newStatMod); break; case StatType.Magic: //Add the modifier to magic magic.AddModifier(newStatMod); break; } }
public void AddBuff(StatBuff buff) { if (buffList == null) { buffList = new List <StatBuff>(); } if (buff.Id != null) { for (int i = 0; i < buffList.Count; i++) { if (buffList[i].Id != null && buffList[i].Id == buff.Id) { return; // buf already added } } } buffList.Add(buff); UpdateStat(buff.StatType); #if UNITY_EDITOR //Debug.Log("Buff Added "); #endif }
virtual public float?calculateStat(StatTypes statType) { if (!hasStat(statType)) { return(null); } float value = 0; int? maxMax = null; int? minMin = null; foreach (Buff buff in buffs) { StatBuff statBuff = buff.getStat(statType); if (statBuff != null && statBuff.BuffType == BuffTypes.TotalAdditive) { if (statBuff.baseStat != null) { value += calculateBaseStat((StatTypes)statBuff.baseStat).Value *statBuff.Value; } else { value += statBuff.Value; } if (maxMax == null || statBuff.MaxValue != null && statBuff.MaxValue < maxMax) { maxMax = statBuff.MaxValue; } if (minMin == null || statBuff.MinValue != null && statBuff.MinValue > minMin) { minMin = statBuff.MinValue; } } } value = (maxMax != null && value > maxMax) ? (int)maxMax : (minMin != null && value < minMin) ? (int)minMin : value; return(value + calculateBaseStat(statType).Value); }
public virtual void ApplyBuff(StatBuff buff) { buff_value += buff.buff_value; buffs.Add(buff); }
public BE_ReceiveBuff(BattleManager _battle, Battler _target, StatBuff _buff) : base(_battle) { target = _target; buff = _buff; }
public StatBuff(StatBuff buff) : base(buff) { value = buff.value; is_flat = buff.is_flat; }
public virtual void AddSetBuff(StatBuff buff) { ClearNonAuraBuffs(); sets_stack.Add(buff); }
public virtual void RemoveBuff(StatBuff buff) { buffs.Remove(buff); changed = true; }
public virtual void AddBuff(StatBuff buff) { buffs.Add(buff); changed = true; }
public virtual void RemoveSetBuff(StatBuff buff) { sets_stack.Remove(buff); }