Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.shitfacedchimpanzee.textGame.model.battle;
- import com.shitfacedchimpanzee.textGame.model.character.Attack;
- import com.shitfacedchimpanzee.textGame.model.character.Character;
- import com.shitfacedchimpanzee.textGame.view.TextOutput;
- import org.jetbrains.annotations.NotNull;
- public class Battle {
- BattleScanner bs = new BattleScanner();
- public String s = new String();
- public Battle() throws InterruptedException {
- }
- public String getResults() {
- return s.toString();
- }
- public BattleScanner getBs() {
- return bs;
- }
- public boolean nobodyDead(Character c) {
- return c.getHealth() > 0;
- }
- public void doBattle(@NotNull Character charOne, @NotNull Character charTwo, Attack attack) throws InterruptedException {
- charTwo.setHealth(charTwo.getHealth() - charOne.getAttack() * attack.getDamage());
- s ("\n")
- + charOne.getName()
- + " did "
- + attack.getName()
- + " it did "
- + (charOne.getAttack() * attack.getDamage())
- + " damage"
- + "\n"
- + charTwo.getName()
- + " now only has "
- + charTwo.getHealth()
- + "\n";
- }
- public String battleResults() {
- return s.toString();
- }
- public void nextAttack(TextOutput tp, Character charOne, Character charTwo) throws InterruptedException {
- Attack attack = this.getBs().whatAttack(charOne, tp);
- this.doBattle(charOne, charTwo, attack);
- tp.letterByLetter(this.getResults());
- if (this.nobodyDead(charTwo)) {
- nextAttack(tp, charTwo, charOne);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement