public void LevelUpActor(Actor actor) { // apply changes to character actor.Level += 1; int HPAdj = GetLevelUpHPAdj(actor); actor.HPBaseMax += HPAdj; // don't reset, just adjust - could be mid-action actor.HPAdjustCurrentMax(HPAdj); actor.HPAdjustCurrent(HPAdj); int MPAdj = GetLevelUpMPAdj(actor); actor.MPBaseMax += MPAdj; // don't reset, just adjust - could be mid-action actor.MPAdjustCurrentMax(MPAdj); actor.MPAdjustCurrent(MPAdj); actor.UpdateAttack(); actor.UpdateDefense(); actor.ReadyToLevelUp = false; }
public void ApplyToTarget(RPGObject targetObject) { this.TargetObject = targetObject; Actor targetActor = targetObject as Actor; string PrintLine = ""; if (targetObject.isOfType(typeof(Actor))) { targetActor = targetObject as Actor; PrintLine += targetActor.Name; } // actually change the target based on the effect if (EffectIsABuff) { switch (TargetBuff) { case (EffectTargetBuff.Attack): { targetActor.BaseAttack += Power; targetActor.UpdateAttack(); PrintLine += " Attack changed by " + Power; break; } case (EffectTargetBuff.Charisma): { targetActor.BaseCharisma += Power; targetActor.ResetAttributes(); PrintLine += " Charisma changed by " + Power; break; } case (EffectTargetBuff.Constitution): { targetActor.BaseConstitution += Power; targetActor.ResetAttributes(); PrintLine += " Constitution changed by " + Power; break; } case (EffectTargetBuff.Defense): { targetActor.BaseDefense += Power; targetActor.UpdateDefense(); PrintLine += " Defense changed by " + Power; break; } case (EffectTargetBuff.Dexterity): { targetActor.BaseDexterity += Power; targetActor.ResetAttributes(); PrintLine += " Dexterity changed by " + Power; break; } case (EffectTargetBuff.Intelligence): { targetActor.BaseIntelligence += Power; targetActor.ResetAttributes(); PrintLine += " Intelligence changed by " + Power; break; } case (EffectTargetBuff.RaiseDamage): { targetActor.BaseDamage += Power; PrintLine += " Damage changed by " + Power; break; } case (EffectTargetBuff.RaiseMaxHP): { targetActor.HPBaseMax += Power; targetActor.HPAdjustCurrentMax(Power); targetActor.HPAdjustCurrent(Power); PrintLine += " Max HP changed by " + Power; break; } case (EffectTargetBuff.RaiseMaxMP): { targetActor.MPBaseMax += Power; targetActor.MPAdjustCurrentMax(Power); targetActor.MPAdjustCurrent(Power); PrintLine += " Max MP changed by " + Power; break; } case (EffectTargetBuff.RestoreHP): { // because we are only restoring, it cannot go over the max targetActor.HPAdjustCurrent(Math.Min(Power, Math.Max(targetActor.HPCurrentMax - targetActor.HPCurrent, 0))); PrintLine += " HP restored by " + Power; break; } case (EffectTargetBuff.RestoreMP): { // because we are only restoring, it cannot go over the max targetActor.MPAdjustCurrent(Math.Min(Power, Math.Max(targetActor.MPCurrentMax - targetActor.MPCurrent, 0))); PrintLine += " MP restored by " + Power; break; } case (EffectTargetBuff.Speed): { targetActor.BaseSpeed += Power; targetActor.CurrentSpeed += Power; PrintLine += " Speed changed by " + Power; break; } case (EffectTargetBuff.Strength): { targetActor.BaseStrength += Power; targetActor.ResetAttributes(); PrintLine += " Strength changed by " + Power; break; } case (EffectTargetBuff.Wisdom): { targetActor.BaseWisdom += Power; targetActor.ResetAttributes(); PrintLine += " Wisdom changed by " + Power; break; } } // end switch } else { } Session.Print(PrintLine); }