Ejemplo n.º 1
0
        public Party( Character[] party )
        {
            /* start constructor */

            mParty = party;
            mPartySize = party.Length;
            mInventory = new List<Item>();
        }
Ejemplo n.º 2
0
 private void spreadItem(Character actingCharacter, Character[] combatants)
 {
     for (int i = 0; i < combatants.Length; i++)
     {
         if (combatants[i].isPlayer && !usedItem.AffectEnemy || !combatants[i].isPlayer && usedItem.AffectEnemy)
         {
             //TODO: Figure out exact application of item
         }
     }
 }
Ejemplo n.º 3
0
 public void specificAction(Character actingCharacter, Character[] combatants)
 {
     if(usedItem.isSingleTarget)
     {
         spreadItem(actingCharacter, combatants);
     }
     else
     {
         singleTargetItem(actingCharacter, specificTarget);
     }
 }
Ejemplo n.º 4
0
 private void singleTargetAbility(Character actingCharacter, Character target)
 {
     int base_stat = 1;
     if (usedAbility.isMagic)
     {
         base_stat = actingCharacter.getStat(StatEnum.MAGIC);
     }
     else
     {
         base_stat = actingCharacter.getStat(StatEnum.STRENGTH);
     }
     target.takeDamage(base_stat * usedAbility.BaseDamage);
 }
Ejemplo n.º 5
0
        public void specificAction(Character actingCharacter, Character[] combatants)
        {
            int cost = usedAbility.Cost;
            actingCharacter.useMana(cost);

            if (usedAbility.isSingleTarget)
            {
                spreadAbility(actingCharacter, combatants);
            }
            else
            {
                singleTargetAbility(actingCharacter, specificTarget);
            }
        }
Ejemplo n.º 6
0
 public void specificAction(Character actingCharacter, Character[] combatants)
 {
     int attack = actingCharacter.getStat(StatEnum.STRENGTH);
     int damage = attack - target.getStat(StatEnum.ARMOR);
     if (damage > 0)
     {
         target.takeDamage(damage);
         attackResult = " attacked and did " + damage + " to ";
     }
     else
     {
         attackResult = " was unable to damage ";
     }
     battleEvents.Add(new BattleEvent(actingCharacter, this, target));
 }
Ejemplo n.º 7
0
        public BattleEvent(Character currentActor, BattleAction actorAction, Character actorTarget)
        {
            mActor = currentActor;
            mAction = actorAction;
            actionOutcome = mAction.ToString();
            mActee = actorTarget;

            if (mActee.isDead && !mActee.isPlayer)
            {
                ((PlayerCharacter)mActor).gainExperience(((Enemy)mActee).Worth);
                kill_string = ", " + mActee.Name + " was vanquished!";
            }

            if (mActee.isDead && mActee.isPlayer)
            {
                kill_string = ", " + mActee.Name + " has been slain!";
            }
        }
Ejemplo n.º 8
0
        private void spreadAbility(Character actingCharacter, Character[] combatants)
        {
            int base_stat = 1;
            if (usedAbility.isMagic)
            {
                base_stat = actingCharacter.getStat(StatEnum.MAGIC);
            }
            else
            {
                base_stat = actingCharacter.getStat(StatEnum.STRENGTH);
            }

            for (int i = 0; i < combatants.Length; i++)
            {
                if (combatants[i].isPlayer && !usedAbility.AffectEnemy || !combatants[i].isPlayer && usedAbility.AffectEnemy)
                {
                    combatants[i].takeDamage(base_stat * usedAbility.BaseDamage);
                }
            }
        }
Ejemplo n.º 9
0
        private void initialize()
        {
            /* start initialize */

            ClassEnum choice;
            int i;
            String name;
            Character[] characters = new Character[ Party.MAXPARTY ];

               // mView = new TextView();

            mDungeon = Dungeon.getInstance(this);
            mView = new DisplayView(viewWindow, mDungeon);

            //for (i = 0; i < Party.MAXPARTY; i++)
            for (i = 0; i < 1; i++)
            {/* start loop */

                choice = mView.getClassChoice();
                name = mView.getCharacterName();

                characters[ i ] = CharacterFactory.getInstance().getCharacter(choice, name);

            }/* end loop */

            mGoodGuys = new Party(characters);
            // mView.GoodGuys = mGoodGuys;
            mBattle = new Battle(this, mGoodGuys);

            mDungeon.SetView(mView);
            mDungeon.SetGame(this);
            //mView.Dungeon = mDungeon.Grid;
        }
Ejemplo n.º 10
0
        public void equipItem( Item item, Character target )
        {
            /* start equipItem */

            mInventory.Remove( item );

            if (item.Type == ItemType.WEAPON)
            {/* start if */

                mInventory.Add(target.Weapon);
                target.Weapon = (Weapon)item;

            }/* end if */
        }
Ejemplo n.º 11
0
 /* For Battle System */
 public BattleAction getPlayerAction(Character character, Party badGuys)
 {
     return null;
 }
Ejemplo n.º 12
0
        public BattleAction getPlayerAction( Character character, Party badGuys )
        {
            /* start getPlayerAction */

            return mView.getPlayerAction(character, badGuys);
        }
Ejemplo n.º 13
0
        private void initialize()
        {
            /* start initialize */

            int choice, i;
            String[] classes = new String[ 6 ] { "Warrior", "Theif", "Monk", "White Mage", "Black Mage", "Red Mage" };
            String name;
            Character[] characters = new Character[ Party.MAXPARTY ];

            for (i = 0; i < Party.MAXPARTY; i++)
            {/* start loop */

                //mView.sendOutput("What class type do you want? You get 3.");
               // mView.sendOutput(classes.GetEnumerator(), TypeEnum.STRING);
               // choice = (int)mView.getInput(TypeEnum.INT);
               // name = (string)mView.getInput(TypeEnum.STRING);

               // characters[ i ] = CharacterCreationFactory(choice, name);

            }/* end loop */

            //mGoodGuys = new Party(characters);
            //mBattle = new BattleSystem(this, mGoodGuys);
               // mDungeon = new Dungeon(this, mGoodGuys);
        }
Ejemplo n.º 14
0
 public BattleAction getPlayerAction(Character character)
 {
     //throw new NotImplementedException();
     return null;
 }
Ejemplo n.º 15
0
 private void singleTargetItem(Character actingCharacter, Character target)
 {
     //TODO: Figure out exact application of item
 }
Ejemplo n.º 16
0
 public AttackAction(Character targetedCharacter)
 {
     target = targetedCharacter;
 }
Ejemplo n.º 17
0
        public bool CompareTo(Character character)
        {
            /* start CompareTo */

            return this.getStat(StatEnum.AGILITY) < character.getStat(StatEnum.AGILITY);
        }
Ejemplo n.º 18
0
        /* Get the first alive character. R.F. 3/13/2014 */
        private void selectFirstCharacter()
        {
            int i = 0;
            currentActor = turnOrder[i];
            currentActorIndex = i;
            //while (!currentActor.isDead)
            //{
            //    i++;
            //    /* Index Out of Bounds exception keeps happening below (R.F.)*/
            //    currentActor = turnOrder[i];
            //    currentActorIndex = i;
            //}

            for (i = 0; i < turnOrder.Length; i++)
            {/* start loop */

                if (!currentActor.isDead)
                    break;

                currentActor = turnOrder[i];
                currentActorIndex = i;

            }/* end loop */
        }
Ejemplo n.º 19
0
 public void specificAction(ref Character target)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 20
0
        public Character[] getTurnOrder(Party otherParty)
        {
            /* start getTurnOrder */

            int size = this.mPartySize + otherParty.mPartySize;
            int i, j;
            Character[] turnOrder = new Character[size];
            Character temp;

            for (i = 0; i < mParty.Length; i++)
                turnOrder[ i ] = mParty[ i ];

            for( j = 0; j < otherParty.mPartySize; j++, i++ )
                turnOrder[ i ] = otherParty.mParty[ j ];

            for (i = 0; i < size; i++)
                for (j = 0; j < size; j++)
                    if ( turnOrder[ i ].CompareTo( turnOrder[ j ] ) )
                    {/* start if */

                        temp = turnOrder[i];
                        turnOrder[i] = turnOrder[j];
                        turnOrder[j] = temp;

                    }/* end if */

            return turnOrder;
        }
Ejemplo n.º 21
0
        /* Possible Infinite Loop Here. R.F. 3/13/2014 */
        private void selectNextCharacter()
        {
            //int i = (currentActorIndex + 1) % turnOrder.Length;
            //currentActor = turnOrder[i];
            //while (!currentActor.isDead)
            //{
            //    i = (i + 1) % turnOrder.Length;
            //    currentActor = turnOrder[i];
            //    currentActorIndex = i;
            //}

            int i;
            Character candidate;

            /* If we can move further along the turnOrder array, then we shall. If not, we need to start over from the beginning,
             * which selectFisrtCharacter can do. */
            if (currentActorIndex + 1 < turnOrder.Length)
                candidate = turnOrder[currentActorIndex + 1];
            else
            {/* start else */

                selectFirstCharacter();
                return;

            }/* end else */

            currentActorIndex++;

            for (i = currentActorIndex; i < turnOrder.Length;)
            {/* start loop */

                if (!candidate.isDead)
                    break;

                i++;

                if (i >= turnOrder.Length)
                    i = 0;

                candidate = turnOrder[i];
                currentActorIndex = i;

            }/* end loop */

            currentActor = candidate;
        }
Ejemplo n.º 22
0
 public abstract void ai(Character[] goodGuys);
Ejemplo n.º 23
0
 public AbilityAction(Ability abilityToUse, Character targetedCharacter)
 {
     usedAbility = abilityToUse;
     specificTarget = targetedCharacter;
 }
Ejemplo n.º 24
0
 public Event(Character currentActor, BattleAction actorAction, Character actorTarget)
 {
     mActor = currentActor;
     mAction = actorAction;
     mActee = actorTarget;
 }
Ejemplo n.º 25
0
 public ItemAction(Item itemToUse, Character targetedCharacter)
 {
     usedItem = (Ability)itemToUse;
     specificTarget = targetedCharacter;
 }
Ejemplo n.º 26
0
 public void takeTurn( Character[] goodGuys )
 {
     /* start takeTurn */
 }
Ejemplo n.º 27
0
        public Party( Character[] party )
        {
            /* start constructor */

            mParty = party;
        }