Ejemplo n.º 1
0
        public bool AddBodyItem(RPGItem item)
        {
            if (item.isOfType(typeof(RPGPotion)))
            {
                return(false);
            }
            else if (BodyItems[(int)item.Slot] != null)
            {
                return(false);
            }
            else
            {
                // the slot is empty, make sure we CAN set it here
                // if item is a wpn
                if (item.Slot == BodySlot.Hand1)
                {
                    // if wpn is two handed
                    if (((RPGWeapon)item).is2Handed == true)
                    {
                        //make sure 2nd hand is empty too.
                        if (BodyItems[(int)BodySlot.Hand2] != null)
                        {
                            return(false);
                        }
                    }
                }
                // if item to be equipped is a shield
                else if (item.Slot == BodySlot.Hand2)
                {
                    // make sure 1st hand is not a two handed weapon
                    if (BodyItems[(int)BodySlot.Hand1] != null)
                    {
                        // we have something in the wpn hand, check it.
                        RPGItem itemInHand = BodyItems[(int)BodySlot.Hand1];
                        if (itemInHand.isOfType(typeof(RPGWeapon)))
                        {
                            RPGWeapon wpn = itemInHand as RPGWeapon;
                            if (wpn.is2Handed)
                            {
                                return(false);
                            }
                        }
                    }
                }

                BodyItems[(int)item.Slot] = item;

                // this could change our stats
                Owner.UpdateAttack();
                Owner.UpdateDefense();
                return(true);
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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);
        }