private void ApplyBuff() { ApplyBuffs = new List <BuffFacade>(); Buffs.ToList().ForEach(x => { ApplyBuffs.Add(BuffFacade.CreateFromBuff(x)); }); // if (ExpressionNumberBuff.Length > 0) // { // string parseExp = ExpressionNumberBuff.Replace("R", RoundNumber.ToString()); // int rs = 0; // rs = 1; // // if (ExpressionEvaluator.Evaluate<int>(parseExp, out rs)) // // { // for (int i = 0; i < rs; i++) // { // ApplyBuffs.Add(BuffFacade.RandomPositiveBuff()); // } // // } // } Events.InvokeOnAction(EVENT_APPLY_BUFF); foreach (BuffFacade b in ApplyBuffs) { b.PerformBuff(EnemyGroup); } }
public static BuffFacade CreateFromBuff(Buff b) { BuffFacade facade = new BuffFacade(); facade.Buff = b.Clone <Buff>(); return(facade); }
public void ApplyBuff(BuffFacade b, int group) { ValidUnits = FindValidUnit(group); foreach (ActionUnit u in ValidUnits) { u.AddBuff(b); } }
public bool AddBuff(BuffFacade b, bool IsApply = true) { Buffs.Add(b); Buffed.Add(false); if (IsApply) { return(CalculateBuff(Buffed.Count - 1)); } return(true); }
public bool ApplyBuff() { if (Formation.Buffs == null || Formation.Buffs.Length <= 0) { return(false); } foreach (Buff b in Formation.Buffs) { BuffFacade actualBuff = BuffFacade.CreateFromBuff(b); ActiveBuffs.Add(actualBuff); foreach (FormationConditionFacade c in Conditions) { c.ApplyBuff(actualBuff, GroupOwner); } } return(true); }
public List <BuffFacade> BuildBuffForRound() { List <BuffFacade> buffs = new List <BuffFacade>(); int nR = RoundManager.Round.Level; if (nR <= 10) { BuffFacade facade = BuffFacade.CreateFromBuff((Buff)ScriptableObject.CreateInstance(typeof(Buff))); facade.Buff.Target = Buff.TargetType.Ally; facade.Buff.Effect = Buff.EffectType.Decrease; facade.Buff.Stat = Buff.StatAffect.Random; facade.Buff.Percent = 30f - ((nR - 1) * 3f); if (facade.Buff.Percent > 0) { buffs.Add(facade); } } else { List <StatAffect> stats = new List <StatAffect>(); float maxPercent = (nR - 10f) * 1f; while (maxPercent > 0) { StatAffect randomStat = BuffFacade.RandomStatAffect(null, stats); BuffFacade facade = BuffFacade.CreateFromBuff((Buff)ScriptableObject.CreateInstance(typeof(Buff))); facade.Buff.Target = Buff.TargetType.Ally; facade.Buff.Effect = Buff.EffectType.Increase; if (randomStat == Buff.StatAffect.Random) { buffs[buffs.Count - 1].Buff.Percent += maxPercent; maxPercent = 0; break; } else { stats.Add(randomStat); facade.Buff.Stat = randomStat; } facade.Buff.Percent = (maxPercent <= 1 ? maxPercent : (int)Random.Range(1f, maxPercent)); maxPercent -= facade.Buff.Percent; buffs.Add(facade); } } return(buffs); }
public bool RemoveBuff(BuffFacade b, bool IsApply = true) { int index = Buffs.IndexOf(b); Debug.Log("Buff unit remove"); if (index == -1) { return(false); } else { if (IsApply) { Debuff(index); } Buffs.RemoveAt(index); Buffed.RemoveAt(index); } Debug.Log("Buff unit remove " + index); return(true); }