Пример #1
0
        public Party( Character[] party )
        {
            /* start constructor */

            mParty = party;
            mPartySize = party.Length;
            mInventory = new List<Item>();
        }
Пример #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
         }
     }
 }
Пример #3
0
 public void specificAction(Character actingCharacter, Character[] combatants)
 {
     if(usedItem.isSingleTarget)
     {
         spreadItem(actingCharacter, combatants);
     }
     else
     {
         singleTargetItem(actingCharacter, specificTarget);
     }
 }
Пример #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);
 }
Пример #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);
            }
        }
Пример #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));
 }
Пример #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!";
            }
        }
Пример #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);
                }
            }
        }
Пример #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;
        }
Пример #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 */
        }
Пример #11
0
 /* For Battle System */
 public BattleAction getPlayerAction(Character character, Party badGuys)
 {
     return null;
 }
Пример #12
0
        public BattleAction getPlayerAction( Character character, Party badGuys )
        {
            /* start getPlayerAction */

            return mView.getPlayerAction(character, badGuys);
        }
Пример #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);
        }
Пример #14
0
 public BattleAction getPlayerAction(Character character)
 {
     //throw new NotImplementedException();
     return null;
 }
Пример #15
0
 private void singleTargetItem(Character actingCharacter, Character target)
 {
     //TODO: Figure out exact application of item
 }
Пример #16
0
 public AttackAction(Character targetedCharacter)
 {
     target = targetedCharacter;
 }
Пример #17
0
        public bool CompareTo(Character character)
        {
            /* start CompareTo */

            return this.getStat(StatEnum.AGILITY) < character.getStat(StatEnum.AGILITY);
        }
Пример #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 */
        }
Пример #19
0
 public void specificAction(ref Character target)
 {
     throw new NotImplementedException();
 }
Пример #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;
        }
Пример #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;
        }
Пример #22
0
 public abstract void ai(Character[] goodGuys);
Пример #23
0
 public AbilityAction(Ability abilityToUse, Character targetedCharacter)
 {
     usedAbility = abilityToUse;
     specificTarget = targetedCharacter;
 }
Пример #24
0
 public Event(Character currentActor, BattleAction actorAction, Character actorTarget)
 {
     mActor = currentActor;
     mAction = actorAction;
     mActee = actorTarget;
 }
Пример #25
0
 public ItemAction(Item itemToUse, Character targetedCharacter)
 {
     usedItem = (Ability)itemToUse;
     specificTarget = targetedCharacter;
 }
Пример #26
0
 public void takeTurn( Character[] goodGuys )
 {
     /* start takeTurn */
 }
Пример #27
0
        public Party( Character[] party )
        {
            /* start constructor */

            mParty = party;
        }