private void InitBuff(BuffTypeEnum typeid, Vector3 pos) // 生成一个buff { Buff newBuff; switch (typeid) { case BuffTypeEnum.HealthBuff: newBuff = new HealthBuff(buffCounter, buffUnusedTime); break; case BuffTypeEnum.SpeedBuff: newBuff = new SpeedBuff(buffCounter, buffDefaultActiveTime, buffUnusedTime); break; case BuffTypeEnum.ShieldBuff: newBuff = new ShieldBuff(buffCounter, buffDefaultActiveCount, buffUnusedTime); break; case BuffTypeEnum.JumpBuff: newBuff = new JumpBuff(buffCounter, buffDefaultActiveTime, buffUnusedTime); break; default: return; } buffCounter++; buffList.Add(newBuff); var obj = Instantiate(buffPrefab); obj.GetComponent <BuffBehaviour>().SetBuff(newBuff); obj.transform.position = pos; buffObjects.Add(newBuff.buffId, obj); }
public static void AddShield(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List <Fighter> affecteds, short castcellid) { foreach (var target in affecteds) { ShieldBuff buff = new ShieldBuff((uint)target.BuffIdProvider.Pop(), effect.BaseEffect.DiceNum, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.Delay); target.AddBuff(buff); } }
public ShieldBuff AddShieldBuff(Fighter target, FightDispellableEnum dispelable, short num) { int id = target.BuffIdProvider.Pop(); ShieldBuff buff = new ShieldBuff(id, target, Source, SpellLevel, Effect, SpellId, num, Critical, dispelable); target.AddAndApplyBuff(buff); return(buff); }
public static void AddShieldPercent(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List <Fighter> affecteds, short castcellid) { short num = (short)((double)fighter.FighterStats.RealStats.LifePoints * ((double)effect.BaseEffect.DiceNum / 100.0)); foreach (var target in affecteds) { ShieldBuff buff = new ShieldBuff((uint)target.BuffIdProvider.Pop(), num, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.Delay); target.AddBuff(buff); } }
public void Update(string key, float value) { ShieldBuff buff = null; if (!ShieldMap.ContainsKey(key)) { Add(key, value); } buff = ShieldMap[key]; buff.Value = value; }
public void Add(string key, float value) { var buff = new ShieldBuff() { Key = key, Value = value, }; ShieldMap.Add(key, buff); ShieldList.Add(buff); }
public void Remove(string key) { ShieldBuff buff = null; if (ShieldMap.ContainsKey(key)) { buff = ShieldMap[key]; } else { return; } ShieldMap.Remove(key); ShieldList.Remove(buff); }
void OnTriggerEnter2D(Collider2D other) { var hero = other.gameObject.GetComponent <Hero>(); if (null == hero) { return; } if (this.PickupType == Type.Shield) { ShieldBuff.AddToHero(hero); } else { hero.Grow(true); } GameObject.Destroy(this.gameObject); }
public BuffShieldSpell(Buff aBuff, GameObject aParent) : base(aBuff, aParent) { ShieldBuff buff = aBuff as ShieldBuff; myCurrentShieldValue = buff.myShieldValue; }
public void StartShieldBuff() { ShieldBuff controller = gameObject.GetComponent <ShieldBuff>(); controller.RestoreShield(); }
/// <summary> /// Called on start, sets the tooltip texts. /// </summary> void Start() { //Renew RenewHot renewHot = new RenewHot(); Renew renew = new Renew(); renew.Awake(); tooltip[1] = "Applies a buff that heals the target for " + (renewHot.HEALPERTICK * (renewHot.DURATION / renewHot.INTERVALLTICKS)) + " health over " + renewHot.DURATION + " seconds. "; tooltip[1] += GenerateSpellString(renew); //greaterHeal GreaterHeal greaterHeal = new GreaterHeal(); greaterHeal.Awake(); tooltip[2] = "A manaefficient spell that heals the target for " + greaterHeal.healAmount + " health. "; tooltip[2] += GenerateSpellString(greaterHeal); //placeholder CircleOfHealing circleOfHealing = new CircleOfHealing(); circleOfHealing.Awake(); tooltip[3] = "A spell that heals the " + circleOfHealing.numberTargets + " partymembers, which currently have the lowest health, for " + circleOfHealing.healAmount + " health each. "; tooltip[3] += GenerateSpellString(circleOfHealing); //prayer of mending PrayerBuff prayerBuff = new PrayerBuff(); Prayer prayer = new Prayer(); tooltip[4] = "Places a ward on a target that heals them for " + prayerBuff.HEALAMOUNT + " health the next time it takes damage, and then jumps to another target. Jumps up to " + prayerBuff.jumpsLeft + " times and lasts " + prayerBuff.DURATION + " seconds. "; tooltip[4] += GenerateSpellString(prayer); //NYI tooltip[5] = "NYI"; //NYI tooltip[6] = "NYI"; //hymn of hope Hymn hymn = new Hymn(); tooltip[7] = "Channels a hymn of hope that heals every partymember for " + (hymn.HEALAMOUNT * hymn.TICKS) + " health over " + hymn.CASTTIME + " seconds. "; tooltip[7] += GenerateSpellString(hymn); //dispell Dispell dispell = new Dispell(); tooltip[8] = "Removes all dispellable debuffs from your target. "; tooltip[8] += GenerateSpellString(dispell); //greaterHeal FlashHeal flashHeal = new FlashHeal(); greaterHeal.Awake(); tooltip[9] = "A fast spell that heals the target for " + flashHeal.HEALAMOUNT + " health. "; tooltip[9] += GenerateSpellString(flashHeal); //shield Shield shield = new Shield(); ShieldBuff shieldBuff = new ShieldBuff(); tooltip[10] = "Places a shield on a target that lasts " + shieldBuff.DURATION + " seconds and absorbs the next " + shieldBuff.absorbAmount + " damage it takes. "; tooltip[10] += GenerateSpellString(shield); //binding heal BindingHeal bindingHeal = new BindingHeal(); tooltip[11] = "A spell that heals the target and the partymember that currently has the lowest health for " + bindingHeal.HEALAMOUNT + " health each. "; tooltip[11] += GenerateSpellString(bindingHeal); //guardian spirit GuardianSpirit guardianSpirit = new GuardianSpirit(); GuardianSpiritBuff guardianSpiritBuff = new GuardianSpiritBuff(); tooltip[12] = "Calls upon a guardian spirit to watch over your target for " + guardianSpiritBuff.DURATION + " seconds and preventing the target from dying by sacificing itself, healing the target to full health. "; tooltip[12] += GenerateSpellString(guardianSpirit); }