public override void UpdateStatus(Prop ch) { if (timer > nextTick) { if (nextTick > 0) { ch.ApplyDamage(damagePerTick, damageType); if (maxTicks != 0) { ticks++; if (ticks >= maxTicks) { End(); } } } nextTick += interval; } }
// apply this power to a particular target // charge varies from 0 to 1 public bool Apply(Prop target, float charge, Character caster, bool doStatus = true) { // calculate chance to hit if (targetType == TargetType.Enemies) { float casterAcc = caster == null ? 0 : caster.stats[RPGSettings.StatName.Accuracy.ToString()].currentValue; float chanceToHit = RPGSettings.instance.baseAccuracy * accuracy + casterAcc - target.stats[RPGSettings.GetDefenceStat(type)].currentValue; if (Random.Range(0, 100) > chanceToHit) { target.NumberFloat("MISS!", Color.white); return(false); } } Character ch = target as Character; if (ch && sounds) { sounds.PlayHit(ch.audioSource); } // how does the damage get factored in? float damage; switch (mode) { case Mode.Charge: damage = minDamage + charge * (maxDamage - minDamage); break; case Mode.Maintain: damage = minDamage + (1 - charge) * (maxDamage - minDamage); break; default: damage = Random.Range(minDamage, maxDamage); break; } if (caster) { damage *= caster.GetFactor(RPGSettings.GetDamageStat(type)); } if (damage != 0) { target.ApplyDamage(damage, type); } if (doStatus) { foreach (Status s in effects) { target.ApplyStatus(s, GetDuration(caster), caster, this); } foreach (Status s in selfEffects) { caster.ApplyStatus(s, GetSelfDuration(caster), caster, this); } // add to a global list of DoT's if not a character? if (target as Character == null) { if (!Prop.activeProps.Contains(target.gameObject)) { Prop.activeProps.Add(target.gameObject); } } } // particles on target if (targetFX) { targetFX.Begin(target.GetBodyPart(targetBodyPart), tint); } // hit responses on the target foreach (HitResponse hr in target.hitResponses) { if (Random.Range(0, 100) < hr.percentage && (hr.damageType & type) != 0) { hr.OnHit(target, damage); } } return(true); }