public void apply(Component target) { startTime = Time.time; minion = target.GetComponent <Minion>(); List <Buff> buffsToRemove = new List <Buff>(); foreach (Buff b in minion.buffs) { if (b is SlowDebuff) { SlowDebuff sb = (SlowDebuff)b; if (this.pct <= sb.pct) { return; } else { buffsToRemove.Add(sb); } } } buffsToRemove.ForEach(buff => buff.finish()); minion.addBuff(this); }
void laser() { float dam = laserDOT.get(); if (laserL3Unlock) { dam += targetMinion.health.getMissing() * laserL3PctMissing / 100f; } if (laserL4Unlock) { dam += targetMinion.health.getPctStart(laserL4PctMax); } targetMinion.takeDamage(dam * Time.deltaTime, this.gameObject, laserIgnoreArmor); if (laserR3Unlock && Time.time >= laserR3lastFire + laserR3tickRate) { DamageModifierBuff dmb = new DamageModifierBuff(4, -laserR3PctModifier * laserR3tickRate); dmb.apply(targetMinion); laserR3lastFire = Time.time; } if (laserSlowPct.get() > 0) { Buff slowBuff = new SlowDebuff(.5f, laserSlowPct.get()); slowBuff.apply(targetMinion); } if (!laserLineRenderer.enabled) { laserLineRenderer.enabled = true; laserImpactEffect.Play(); laserImpactLight.enabled = true; } laserLineRenderer.SetPosition(0, firePoint.position); laserLineRenderer.SetPosition(1, target.position); Vector3 dir = firePoint.position - target.position; laserImpactEffect.transform.rotation = Quaternion.LookRotation(dir); laserImpactEffect.transform.position = target.position + dir.normalized; }