public Party( Character[] party ) { /* start constructor */ mParty = party; mPartySize = party.Length; mInventory = new List<Item>(); }
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 } } }
public void specificAction(Character actingCharacter, Character[] combatants) { if(usedItem.isSingleTarget) { spreadItem(actingCharacter, combatants); } else { singleTargetItem(actingCharacter, specificTarget); } }
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); }
public void specificAction(Character actingCharacter, Character[] combatants) { int cost = usedAbility.Cost; actingCharacter.useMana(cost); if (usedAbility.isSingleTarget) { spreadAbility(actingCharacter, combatants); } else { singleTargetAbility(actingCharacter, specificTarget); } }
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)); }
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!"; } }
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); } } }
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; }
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 */ }
/* For Battle System */ public BattleAction getPlayerAction(Character character, Party badGuys) { return null; }
public BattleAction getPlayerAction( Character character, Party badGuys ) { /* start getPlayerAction */ return mView.getPlayerAction(character, badGuys); }
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); }
public BattleAction getPlayerAction(Character character) { //throw new NotImplementedException(); return null; }
private void singleTargetItem(Character actingCharacter, Character target) { //TODO: Figure out exact application of item }
public AttackAction(Character targetedCharacter) { target = targetedCharacter; }
public bool CompareTo(Character character) { /* start CompareTo */ return this.getStat(StatEnum.AGILITY) < character.getStat(StatEnum.AGILITY); }
/* 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 */ }
public void specificAction(ref Character target) { throw new NotImplementedException(); }
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; }
/* 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; }
public abstract void ai(Character[] goodGuys);
public AbilityAction(Ability abilityToUse, Character targetedCharacter) { usedAbility = abilityToUse; specificTarget = targetedCharacter; }
public Event(Character currentActor, BattleAction actorAction, Character actorTarget) { mActor = currentActor; mAction = actorAction; mActee = actorTarget; }
public ItemAction(Item itemToUse, Character targetedCharacter) { usedItem = (Ability)itemToUse; specificTarget = targetedCharacter; }
public void takeTurn( Character[] goodGuys ) { /* start takeTurn */ }
public Party( Character[] party ) { /* start constructor */ mParty = party; }