Exemple #1
0
 private boolean doAttack(JSONObject action) {
   Champion c1 = board.getChampionById((String) action.get("actor1"));
   Champion c2 = board.getChampionById((String) action.get("actor2"));
   if (c1 != null) {
     if (c1.doAttack((String) action.get("attack"))) {
       Attack a = c1.getAttackById((String) action.get("attack"));
       if (a == null) {
         errorString = "Attack Doesn't exist!";
         return false;
       }
       int damage = a.getDamage();
       if (c2 != null && c2.takeDamage(damage)) {
         return true;
       } else {
         errorString = "Champion 2 Not Found!";
         return false;
       }
     } else {
       errorString = "Not a valid move";
       return false;
     }
   } else {
     errorString = "Champion Not Found!";
     return false;
   }
 }
Exemple #2
0
 /* ATTACK test */
 public void testAttack() {
   Attack damage = new Attack(3);
   Attack attack = damage.attack(1);
   assertEquals(3, attack.amount);
   attack = damage.attack(2);
   assertEquals(6, attack.amount);
 }
 public void attack(Subject targetSubject, int attackNumber) {
   Attack attack = attacks.get(attackNumber);
   int hitModifier =
       dice.nextInt(100) + attack.getAccuracyBonus() + getAccuracy() - targetSubject.getEvasion();
   if (hitModifier >= 95) {
     hit(targetSubject, attack, 2, true);
   } else if (hitModifier >= 15) {
     hit(targetSubject, attack, 1, false);
   } else {
     DisplayText.add(
         nickname, String.format("%s brukte %s, men bommet", nickname, attack.getName()));
   }
 }
Exemple #4
0
  /** The player will perform a simple MeleeAttack. */
  public void simpleAttack() {
    if (state == DynamicObjectState.Attacking) return;

    state = DynamicObjectState.Attacking;

    if (!isInNetwork) {
      curAnim = simpleAttack.getAnimation(heading);
      manager.registerAttack(simpleAttack);
      simpleAttack.activate();
    } else {
      NetworkManager.sendAttackMessage(this);
    }
  }
Exemple #5
0
  static void runAttacker(RobotController rc, int squad) throws GameActionException {

    Team team = rc.getTeam();
    Team enemy = team.opponent();

    int squadInfo = rc.readBroadcast(squad);
    MapLocation target = Conversion.intToMapLocation(squadInfo);
    MapLocation curr = rc.getLocation();

    Robot[] allies =
        rc.senseNearbyGameObjects(Robot.class, rc.getType().attackRadiusMaxSquared * 2, team);

    // First steps away from home HQ
    if (curr.distanceSquaredTo(rc.senseHQLocation()) < 25) Move.tryToMove(rc);

    // attack!
    Robot[] enemyRobots =
        rc.senseNearbyGameObjects(Robot.class, rc.getType().sensorRadiusSquared * 2, enemy);
    MapLocation eloc = Attack.nearestEnemyLoc(rc, enemyRobots, rc.getLocation());

    if (eloc != null) {
      if (rc.isActive()) Move.moveToward(rc, eloc);
      if (rc.isActive() && rc.canAttackSquare(eloc)) rc.attackSquare(eloc);
    }

    // Go to right place
    if (curr.distanceSquaredTo(target) > 7) {
      // System.out.println(target + " target " + allies.length + "ally length");
      Move.moveTo(rc, target);
    }
  }
  public void userMove(Attack atk) {
    clearBottom();
    atk.reducePP();

    int power = CalculateAttack(atk, true);
    SlidePic(false);
    RotatePic(true);
    if (enemyPokemon.getHealth() <= power) {
      enemyPokemon.setHealth(0);
    } else {
      enemyPokemon.setHealth(enemyPokemon.getHealth() - power);
    }
    SetEnemy();
    if (enemy.isDead()) {
      MainText.setText("You Win");
      MainText.setVisibility(View.VISIBLE);
      PopUp3.setVisibility(View.INVISIBLE);
      PopUp2.setVisibility(View.INVISIBLE);
      PopUp.setVisibility(View.INVISIBLE);
      recall = 1;
    } else if (enemyPokemon.getHealth() <= 0) {
      launchText3("");
      recall = 1;
    }
  }
 public void calculateStats() { // calculates stats based on equipped items
   if (equipment.itemAt(0, 0) != null) atk.damage = equipment.itemAt(0, 0).value1;
   if (equipment.itemAt(0, 1) != null)
     atkSpd = ((double) equipment.itemAt(0, 1).value1 / 100.0 + 1) * 0.8;
   if (equipment.itemAt(0, 2) != null) {
     armor = equipment.itemAt(0, 2).value1;
     maxHealth = 100 + equipment.itemAt(0, 2).value2;
   }
   if (equipment.itemAt(0, 3) != null) {
     armor += equipment.itemAt(0, 3).value1;
     maxMana = 100 + equipment.itemAt(0, 3).value2;
   }
   if (equipment.itemAt(0, 4) != null) {
     maxHealth += equipment.itemAt(0, 4).value1;
     atk.damage += equipment.itemAt(0, 4).value2;
   }
 }
 @Override
 public Attack getMove(IBattleParticipant participant2) {
   return Attack.getWhichMoveIsBest(
       trainer.releasedPokemon.getHelper().getMoveset(),
       participant2.currentPokemon().getType(),
       trainer.releasedPokemon.getHelper(),
       participant2.currentPokemon());
 }
Exemple #9
0
 @Override
 public void finish() {
   super.finish();
   character.moveLock = false;
   character.jumpLock = false;
   character.tagLock = false;
   character.animationLock = false;
 }
Exemple #10
0
 public void run() {
   while (Attack.isFlooding()) {
     try {
       Socket socket = new Socket(super.getTarget(), super.getPort());
       socket.close();
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
 }
Exemple #11
0
  static void runDefender(RobotController rc, int squad) throws GameActionException {
    Team team = rc.getTeam();
    Team enemy = team.opponent();

    int squadInfo = rc.readBroadcast(squad);
    MapLocation target = Conversion.intToMapLocation(squadInfo);
    MapLocation curr = rc.getLocation();

    int status = rc.readBroadcast(squad + 1);
    int PASTRstatus = Channels.NTPASTRDecoding(status)[1];
    int NTstatus = Channels.NTPASTRDecoding(status)[0];

    Robot[] allies =
        rc.senseNearbyGameObjects(Robot.class, rc.getType().attackRadiusMaxSquared * 2, team);

    // Create a PASTR/NT if not already there

    // System.out.println(allies.length + " " + rc.readBroadcast(Channels.numAlliesNeededChannel));
    if (allies.length >= rc.readBroadcast(Channels.numAlliesNeededChannel)
        && curr.distanceSquaredTo(target) < distanceThreshold
        && rc.isActive()) {
      if (PASTRstatus == 0) {
        rc.construct(RobotType.PASTR);
        rc.broadcast(squad + 1, Channels.NTPASTREncoding(NTstatus, 1));
        System.out.println("Constructing a PASTR...");

      } else if (NTstatus == 0) {
        rc.construct(RobotType.NOISETOWER);
        rc.broadcast(squad + 1, Channels.NTPASTREncoding(1, PASTRstatus));
        System.out.println("Constructing a NT...");
      }
    }

    // Then go to right place
    if (curr.distanceSquaredTo(target) > 8) Move.moveTo(rc, target);

    // Then attack!
    Robot[] enemyRobots =
        rc.senseNearbyGameObjects(Robot.class, rc.getType().sensorRadiusSquared * 2, enemy);
    MapLocation eloc = Attack.nearestEnemyLoc(rc, enemyRobots, rc.getLocation());

    if (eloc != null) {
      if (rc.isActive()) Move.moveToward(rc, eloc);
      if (rc.isActive() && rc.canAttackSquare(eloc)) rc.attackSquare(eloc);
    }

    // If there is a pastr and noisetower, don't block them!
    if (PASTRstatus == 1 && NTstatus == 1) {
      if (enemyRobots.length == 0 && rc.senseCowsAtLocation(rc.getLocation()) > 30) {
        Move.tryToSneak(rc);
      }
    }
  }
  private void hit(
      Subject targetSubject, Attack attack, double damageModifier, boolean criticalHit) {
    double typeModifier = attack.getAttackModifier(targetSubject);
    double STAB = 1;
    if (attack.getType().is(type.getType())) {
      STAB = 1.5;
    }
    double randNumber = dice.nextInt(151) / 1000 + 0.85;
    boolean superEffective = false;
    boolean notEffective = false;
    if (typeModifier == 2.0) {
      superEffective = true;
    } else if (typeModifier == 0.5) {
      notEffective = true;
    }
    int offence = 1;
    int defence = 1;

    offence = (attack.isPracticalAttack()) ? getPracticalOffence() : getTheoreticalOffence();
    defence =
        (attack.isPracticalDefence())
            ? targetSubject.getPracticalDefence()
            : targetSubject.getTheoreticalDefence();

    int damage =
        (int)
            Math.floor(
                ((2 * level + 10)
                            * attack.getDamage()
                            * offence
                            * damageAndHpMultiplier
                            / 250
                            / defence
                        + 2)
                    * damageModifier
                    * randNumber
                    * STAB
                    * typeModifier);

    String combatText =
        String.format("%s bruker %s! (%d skade)", nickname, attack.getName(), damage);

    if (criticalHit) {
      combatText += " (kritisk treff!)";
    }
    if (superEffective) {
      combatText += " (kjempeeffektivt!)";
    } else if (notEffective) {
      combatText += " (ikke så veldig effektivt!)";
    }

    DisplayText.add(nickname, combatText);

    targetSubject.takeDamage(damage);
  }
 public int CalculateAttack(Attack atk, Boolean isUser) {
   Pokemon mon;
   Pokemon other;
   if (isUser) {
     mon = userPokemon;
     other = enemyPokemon;
   } else {
     mon = enemyPokemon;
     other = userPokemon;
   }
   double attack = mon.getStats().getAtk();
   double defense = other.getStats().getDef();
   double damage = .84;
   damage *= (attack / defense);
   damage *= atk.getValue();
   return (int) damage + 2;
 }
  public void drawInfo(Graphics g, Image background) {
    g.drawImage(background, 48, 48, null);
    drawBig(g, new Vector(118, 140));
    String nameString =
        (getNickName().equals(getName()))
            ? getName()
            : String.format("%s (%s)", getNickName(), getName());
    g.drawString(nameString, 206, 136);
    g.drawString("Type: " + getType(), 206, 166);
    g.drawString("Level: " + getLevel(), 206, 186);
    g.drawString(String.format("Helse: %d / %d", getHealth(), getTotalHealth()), 206, 206);
    g.drawString(
        String.format("Studiepoeng: %d / %d", getExperience(), getNextLevelExperience()), 150, 255);
    g.drawString("Fart: " + getSpeed(), 150, 275);
    g.drawString("Treffsikkerhet: " + getAccuracy(), 150, 295);
    g.drawString("Unnvikelsesevne: " + getEvasion(), 150, 315);
    g.drawString("Praktisk styrke: " + getPracticalOffence(), 150, 335);
    g.drawString("Teoretisk styrke: " + getTheoreticalOffence(), 150, 355);
    g.drawString("Praktisk forsvar: " + getPracticalDefence(), 150, 375);
    g.drawString("Teoretisk forsvar: " + getTheoreticalDefence(), 150, 395);

    for (int i = 0; i < attacks.size(); i++) {
      int baseX = 0;
      int baseY = 0;

      switch (i) {
        case 0:
          baseX = 337;
          baseY = 150;
          break;
        case 1:
          baseX = 337;
          baseY = 288;
          break;
        case 2:
          baseX = 432;
          baseY = 169;
          break;
        case 3:
          baseX = 432;
          baseY = 302;
          break;
      }
      Attack attack = attacks.get(i);
      g.drawLine(baseX - 3, baseY + 2, baseX + 83, baseY + 2);
      g.drawString(attack.getName(), baseX + 2, baseY - 3);
      g.drawString("Skade: " + attack.getDamage(), baseX, baseY + 20);
      g.drawString((attack.isPracticalAttack()) ? "Praktisk" : "Teoretisk", baseX, baseY + 40);
      g.drawString("Treffevne: " + attack.getAccuracyBonus(), baseX, baseY + 60);
      g.drawString("" + attack.getType(), baseX, baseY + 80);
    }
  }
  public void update(int delta, Character owner, Character other) {
    if (attackPhase == 0 && progress > beginRunTime) {
      owner.move(new Vector2f(runSpeed * delta * (facingRight ? 1 : -1), 0f));
      if (Math.abs(other.getX() - owner.getX()) < whackDistance) {
        whackBeginTime = progress;
        attackPhase++;
      }
    } else if (attackPhase == 1 && progress > whackBeginTime + whackHurtTime) {
      attackPhase++;
    } else if (attackPhase == 2
        && (hasHit || progress > whackBeginTime + whackHurtTime + whackDuration)) {
      attackPhase++;
    } else if (attackPhase == 3
        && progress > whackBeginTime + whackHurtTime + whackDuration + whackRecoverTime) {
      finishAttack(owner);
    }

    super.update(delta, owner, other);
  }
Exemple #16
0
  public void assignTargets(Simulator sim, Set<Unit> enemies) {

    GameState s = sim.getGameState();
    Unit ally = s.getUnit(getUnitID());
    Region region = sim.getState().getMap().getRegion(ally);

    // divide damage equally among enemies.
    //
    final int M = enemies.size();
    for (Unit enemy : enemies) {
      String msg =
          ally.getOwnerId()
              + ":"
              + ally.getUnitId()
              + " attacks "
              + enemy.getOwnerId()
              + ":"
              + enemy.getUnitId()
              + " "
              + enemy.getUnitTypeString()
              + " in region "
              + region.getId();
      simlog.info(s.getCycle() + "\t" + msg);
      int damage = Math.max(Math.round(Attack.getDamage(ally, enemy) / (float) M), 1);
      if (damage > 0) {
        sim.addChange(new AttributeDifference(enemy.getUnitId(), "hitPoints", -damage));
        simlog.info(
            s.getCycle()
                + "\t"
                + "damage -"
                + damage
                + " to enemy "
                + enemy.getOwnerId()
                + ":"
                + enemy.getUnitId()
                + " "
                + enemy.getUnitTypeString()
                + " in region "
                + region.getId());
      }
    }
  }
  public String getSubjectGoreMessage(Living who, Attack attack, int hitLocation) {
    Living attacker = attack.attacker;

    Damage damage = attack.getMaxDamage();
    int maxHp = Math.max(who.getMaxHp(), 1);
    int percentage = (int) ((damage.damage * 100) / maxHp);
    String location = who.getRace().getHitLocation(hitLocation);
    return "You are an insect, and just suffered " + percentage + "% of damage. ";
    /*
    if(percentage < 1)
    	return "You hardly notice "+attacker.getPossessive()+"s "+attack.weapon.getObjectHitVerb(damage.type)+".";
    else if(percentage < 2)
    	return Print.capitalize(attacker.getPossessive())+"s "+attack.weapon.getName()+" bounces off your "+location+", causing minor damage.";
    else if(percentage < 3)
      return "The "+attack.weapon.getName()+" leaves a small bruise on your "+location+".";
    else if(percentage < 4)
    	return "A few scratches are left on your "+location+" by "+attacker.getPossessive()+"s "+attack.weapon.getHitNoun(damage.type)+".";
    else if(percentage < 5)
    	return "You flinch as "+attacker.getPossessive()+"s blow lands on your "+location+".";
    else if(percentage < 6)
      return "The "+attack.weapon.getHitNoun(damage.type)+" connects with your "+location+" causing a small flesh wound.";
    else if(percentage < 7)
       return "Your "+attack.weapon.getObjectHitVerb(damage.type)+" at the "+who.getRace().getName()+"s "+location+" leaves a nasty bleeding wound.";
    else if(percentage < 9)
      return "You grunt as "+attacker.getPossessive()+" "+attack.weapon.getObjectHitVerb(damage.type)+" slices through your skin.";
    else if(percentage < 12)
      return "Skin and muscle is torn apart by the "+attacker.getRace().getName()+"s powerful "+attack.weapon.getObjectHitVerb(damage.type)+" to your "+location+".";
    else if(percentage < 15)
      return Print.capitalize(attacker.getName())+" drives "+attacker.getPossessive()+" "+attack.weapon.getName()+" to your "+location+", severing tendons and major blood vessels.";
    else if(percentage < 20)
      return "You cry out in pain as the "+attacker.getRace().getName()+"s swift "+attack.weapon.getObjectHitVerb(damage.type)+" connects to your "+location+", penetrating to the bone.";
    else if(percentage < 40)
      return Print.capitalize(attacker.getPossessive())+" powerful "+attack.weapon.getName()+" "+attack.weapon.getObjectHitVerb(damage.type)+" snaps several large bones and leaves your "+location+" bleeding.";
    else if(percentage < 60)
      return "A mass of your blood and internal organs fall out as the "+attacker.getRace().getName()+" connects a mighty "+attack.weapon.getObjectHitVerb(damage.type)+" with "+attacker.getPossessive()+".";
    else if(percentage < 90)
      return "Your "+location+" is reduced into a bloody mess of organs and broken bones by the devastating "+attack.weapon.getObjectHitVerb(damage.type)+".";
    else
      return Print.capitalize(attacker.getName())+"s incredible "+attack.weapon.getObjectHitVerb(damage.type)+" turns your body into a broken mass of guts and blood.";
      */
  }
  public String getAttackerGoreMessage(Living who, Attack attack, int hitLocation) {
    Damage damage = attack.getMaxDamage();
    int maxHp = Math.max(who.getMaxHp(), 1);
    int percentage = (int) ((damage.damage * 100) / maxHp);
    String location = who.getRace().getHitLocation(hitLocation);

    if (percentage < 1)
      return "Your "
          + attack.weapon.getName()
          + " bounces off "
          + who.getName()
          + "'s tough shell, causing only minor scratches.";
    else if (percentage < 2)
      return Print.capitalize(who.getName())
          + " scuttles nimbly, avoiding your "
          + attack.weapon.getObjectHitVerb(damage.type)
          + " almost completely.";
    else if (percentage < 3)
      return "A few marks are left on "
          + who.getName()
          + "'s chitinous "
          + location
          + " by your "
          + attack.weapon.getObjectHitVerb(damage.type)
          + ".";
    else if (percentage < 4)
      return "The "
          + attack.weapon.getName()
          + " lands on "
          + who.getName()
          + "'s "
          + location
          + " with a loud crunch, but the exoskeleton seems to hold.";
    else if (percentage < 5)
      return Print.capitalize(who.getName())
          + "'s numerous legs twitch in pain as your blow lands on "
          + who.getPossessive()
          + " "
          + location
          + ".";
    else if (percentage < 6)
      return "The "
          + attack.weapon.getObjectHitVerb(damage.type)
          + " connects with "
          + who.getName()
          + "'s "
          + location
          + " causing a crack to appear on "
          + who.getPossessive()
          + " shell.";
    else if (percentage < 7)
      return "Your "
          + attack.weapon.getHitNoun(damage.type)
          + " at the "
          + who.getRace().getName()
          + ", leaving "
          + who.getPossessive()
          + " "
          + location
          + " oozing green fluids.";
    else if (percentage < 9)
      return Print.capitalize(who.getName())
          + " quivers in pain as the "
          + attack.weapon.getObjectHitVerb(damage.type)
          + " rips through "
          + who.getPossessive()
          + " exoskeleton at "
          + location
          + ".";
    else if (percentage < 12)
      return Print.capitalize(who.getName())
          + " drops from "
          + who.getPossessive()
          + " legs as your "
          + attack.weapon.getObjectHitVerb(damage.type)
          + " easilly penetrates "
          + who.getPossessive()
          + " tough carapace.";
    else if (percentage < 15)
      return "You drive the "
          + attack.weapon.getName()
          + " to "
          + who.getName()
          + "'s "
          + location
          + ", causing a major squirt of viscous fluids to fly trough the air.";
    else if (percentage < 20)
      return Print.capitalize(who.getName())
          + " wraps "
          + who.getPossessive()
          + " legs around "
          + who.getPronoun()
          + " in agony as the swift "
          + attack.weapon.getObjectHitVerb(damage.type)
          + " crunches trough "
          + who.getPossessive()
          + " shell.";
    else if (percentage < 40)
      return "Chitinous exoskeleton at "
          + who.getName()
          + "'s "
          + location
          + " is ripped apart by the powerful "
          + attack.weapon.getObjectHitVerb(damage.type)
          + ".";
    else if (percentage < 60)
      return "The powerful "
          + attack.weapon.getName()
          + " "
          + attack.weapon.getObjectHitVerb(damage.type)
          + " breaks "
          + who.getName()
          + "'s exoskeleton open, exposing the soft innards inside.";
    else if (percentage < 90)
      return Print.capitalize(who.getName())
          + "'s "
          + location
          + " is smashed into a mess of slime and chitin pieces by the ferocious "
          + attack.weapon.getObjectHitVerb(damage.type)
          + ".";
    else
      return "Your devastating "
          + attack.weapon.getObjectHitVerb(damage.type)
          + " sends the crushed body of "
          + who.getName()
          + " flying trough the air, leaving a trail of sticky innards on the ground.";
  }
Exemple #19
0
  public static void main(String[] args) {
    String serverResponse = new String();
    ArrayList prevGameHits = new ArrayList();

    Log.WriteLog("\nStarting new match.");
    while (!Outcome.isMatchOver(serverResponse)) {

      /* Clear the string so we don't continue exiting the inner while-loop */
      serverResponse = null;
      serverResponse = new String();

      Log.WriteLog("\nStarting new game.");
      Battleship bShip = new Battleship();

      /* Connect to the game server */
      try {
        bShip.pComm.connect();
      } catch (IOException e) {
        System.err.println(e);
      }

      /* Log the connection banner */
      try {
        Log.WriteLog("Connection banner: " + bShip.pComm.readLine());
      } catch (IOException e) {
        System.err.println(e);
      }

      /* Login to the game */
      bShip.pComm.login();

      /* Print the login response */
      try {
        serverResponse = bShip.pComm.readLine();
        Log.WriteLog("Login response: " + serverResponse);
      } catch (IOException e) {
        System.err.println(e);
      }

      if (Outcome.didFail(serverResponse)) return;

      /* Send ship layout */
      bShip.pComm.sendShipLayout(bShip.myShips.generateLayout());

      /* Print ship layout response */
      try {
        serverResponse = bShip.pComm.readLine();
        Log.WriteLog("Ship layout response: " + serverResponse);
      } catch (IOException e) {
        System.err.println(e);
      }

      /* Copy over the previous games hits to our Attack object */
      bShip.attack.prevGameHits = prevGameHits;

      /* Begin the game & wait until it's over */
      while (!Outcome.isGameOver(serverResponse) && !Outcome.isMatchOver(serverResponse)) {

        Coordinate attackCoordinate = bShip.attack.generateAttack();
        bShip.pComm.fire(attackCoordinate);

        /* Increment the current turn */
        bShip.attack.incrementTurn();

        /* Process the response (HIT/MISS) */
        try {
          serverResponse = bShip.pComm.readLine();
          Log.WriteLog(
              "Turn " + bShip.attack.getCurrentTurn() + " attack response: " + serverResponse);
          bShip.attack.processAttackResponse(serverResponse, attackCoordinate);
        } catch (IOException e) {
          System.err.println(e);
        }
      }

      /* The game is now over. Copy all the hits into prevGameHits so we can check them next game. */
      prevGameHits.clear();
      bShip.attack.copyGameHits(prevGameHits);

      /* Close the connection */
      try {
        bShip.pComm.close();
      } catch (IOException e) {
        System.err.println(e);
      }
    }
  }
Exemple #20
0
 public void save(Node node) {
   super.save(node);
 }
Exemple #21
0
 public void load(Node node) {
   super.load(node);
 }
 public void reset(int time) {
   super.reset(time);
   attackPhase = 0;
 }
 public void finishAttack(Character owner) {
   super.finishAttack(owner);
   owner.setGravityMultiplier(1f);
 }
 public void start(Character owner, boolean facingRight) {
   super.start(owner, facingRight);
   owner.setGravityMultiplier(.4f);
 }
public class oifeyStats {
  Attack attackStat = new Attack();
  FillSkillList fSL = new FillSkillList();
  Avoid avoidStat = new Avoid();
  Critical criticalStat = new Critical();
  Hit hitStat = new Hit();
  equippedWeapon eW = new equippedWeapon();
  randomBloodType rBT = new randomBloodType();
  setBonus sB = new setBonus();

  noWeaponStats n = new noWeaponStats();
  genItem nW = new genItem(n.allStats, n.remainingStats);
  armorslayerStats a = new armorslayerStats();
  genItem armorslayer =
      new genItem(
          a.allStats,
          new boolean[] {
            true, false, false, false, false, false, false, false, false, false, false
          });
  javelinStats j = new javelinStats();
  genItem javelin = new genItem(j.allStats, j.remainingStats);
  public int team = 0;
  public int characterID = 28;
  public int classID = 46;
  public int baseClass = 3;
  public int level = 1;
  public int maxLevel = 20;
  public int exp = 0;
  public int[] currentStats = new int[] {40, 40, 28, 14, 28, 27, 12, 30, 14, 9};
  // Baldo, Odo, Hezul, Noba, Dain, Neir, Ulir, Blagi, Fala, Tordo, Holsety, Narga, Loputousu
  public int[] bloodTypePercents = new int[] {16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  public int[] basePercents = new int[] {1000, 400, 50, 500, 300, 400, 300, 100};
  public int[] bonusPercents = rBT.getBloodPercent(bloodTypePercents);
  // 0->1 "-", 1->30 "D", 30->70 "C", 70->120 "B", 120->180 "A", 180->250 "S"
  public int[] weaponEXP = new int[] {71, 71, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  public int[] skills = new int[] {3, 7, 32, 33, 0, 0};
  public int[] skillList = fSL.getSkillList();
  public int kills = 0;
  public int gold = 5000;
  public int sex = 0;
  public int marriedID = 0;
  public int[] childOne = new int[] {-1, -1};
  public int[] childTwo = new int[] {-1, -1};
  public int[] childThree = new int[] {-1, -1};
  public boolean isLeader = false;
  public int leadershipStars = 0;
  public item[] weapons = new item[] {armorslayer, javelin, nW, nW, nW, nW, nW};

  public int[] bonusStats = sB.getBonus(skills, eW.getEquippedWeapon(weapons));
  public int attack = attackStat.getAttack(eW.getEquippedWeapon(weapons), currentStats, bonusStats);
  public int hit =
      hitStat.getHit(
          eW.getEquippedWeapon(weapons),
          currentStats[4],
          bonusStats[3],
          currentStats[6],
          bonusStats[5],
          skills);
  public int crit =
      criticalStat.getCritical(
          eW.getEquippedWeapon(weapons), currentStats[4], bonusStats[3], skills, kills);
  public int avoid =
      avoidStat.getAvoid(currentStats[5], bonusStats[4], currentStats[6], bonusStats[5], skills);
}
public class bowFighterThreeStats {
  Attack attackStat = new Attack();
  FillSkillList fSL = new FillSkillList();
  Avoid avoidStat = new Avoid();
  Critical criticalStat = new Critical();
  Hit hitStat = new Hit();
  equippedWeapon eW = new equippedWeapon();
  randomBloodType rBT = new randomBloodType();

  setBonus sB = new setBonus();

  noWeaponStats n = new noWeaponStats();
  genItem nW = new genItem(n.allStats, n.remainingStats);
  ironBowStats i = new ironBowStats();
  genItem ironBow =
      new genItem(
          i.allStats,
          new boolean[] {
            true, false, false, false, false, false, false, false, false, false, false
          });

  static final Random r = new Random();
  public int team = 2;
  public int characterID = 187;
  public int classID = 23;
  public int baseClass = 23;
  public int level = 1;
  public int maxLevel = 20;
  public int exp = 0;
  public int internalLevel = 15;
  // Baldo, Odo, Hezul, Noba, Dain, Neir, Ulir, Blagi, Fala, Tordo, Holsety, Narga, Loputousu
  public int[] bloodTypePercents = new int[13];
  static int randomHP = r.nextInt(100);
  static int randomStr = r.nextInt(200);
  static int randomMgc = r.nextInt(100);
  static int randomSkl = r.nextInt(200);
  static int randomSpd = r.nextInt(200);
  static int randomLck = r.nextInt(300);
  static int randomDef = r.nextInt(200);
  static int randomRes = r.nextInt(200);
  public int[] basePercents =
      new int[] {
        600 + randomHP,
        400 + randomStr,
        100 + randomMgc,
        300 + randomSkl,
        300 + randomSpd,
        100 + randomLck,
        300 + randomDef,
        100 + randomRes
      };
  public int[] bonusPercents = rBT.getBloodPercent(bloodTypePercents);
  public int hpAddition = rBT.getRandomStats(internalLevel, basePercents[0]);
  public int[] currentStats =
      new int[] {
        20 + hpAddition,
        20 + hpAddition,
        rBT.getRandomStats(internalLevel, basePercents[1]),
        rBT.getRandomStats(internalLevel, basePercents[2]),
        rBT.getRandomStats(internalLevel, basePercents[3]),
        rBT.getRandomStats(internalLevel, basePercents[4]),
        rBT.getRandomStats(internalLevel, basePercents[5]),
        rBT.getRandomStats(internalLevel, basePercents[6]),
        rBT.getRandomStats(internalLevel, basePercents[7]),
        5
      };
  // 0->1 "-"
  // 1->30 "D"
  // 30->70 "C"
  // 70->120 "B"
  // 120->180 "A"
  // 180->250 "S"
  public int[] weaponEXP = new int[] {0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0};
  public static int randomSkill = 53;

  public static int getRandomSkill() {
    while (randomSkill == 53) {
      randomSkill = r.nextInt(112) + 1;
    }
    return randomSkill;
  }

  public int[] skills = new int[] {53, getRandomSkill(), 0, 0, 0, 0};
  public int[] skillList = fSL.getSkillList();
  public int kills = 0;
  public int gold = 2000;
  public int sex = 0;
  public int marriedID = 0;
  public int[] childOne = new int[] {-1, -1};
  public int[] childTwo = new int[] {-1, -1};
  public int[] childThree = new int[] {-1, -1};
  public boolean isLeader = false;
  public int leadershipStars = 0;
  public static int randomKills = r.nextInt(100);
  public item[] weapons = new item[] {ironBow, nW, nW, nW, nW, nW, nW};

  public int[] bonusStats = sB.getBonus(skills, eW.getEquippedWeapon(weapons));
  public int attack = attackStat.getAttack(eW.getEquippedWeapon(weapons), currentStats, bonusStats);
  public int hit =
      hitStat.getHit(
          eW.getEquippedWeapon(weapons),
          currentStats[4],
          bonusStats[3],
          currentStats[6],
          bonusStats[5],
          skills);
  public int crit =
      criticalStat.getCritical(
          eW.getEquippedWeapon(weapons), currentStats[4], bonusStats[3], skills, kills);
  public int avoid =
      avoidStat.getAvoid(currentStats[5], bonusStats[4], currentStats[6], bonusStats[5], skills);
}
public class juliusStats // This Character's Mother is Diadora (Father is always Alvis)
 {
  Attack attackStat = new Attack();
  FillSkillList fSL = new FillSkillList();
  Avoid avoidStat = new Avoid();
  Critical criticalStat = new Critical();
  Hit hitStat = new Hit();
  equippedWeapon eW = new equippedWeapon();
  randomBloodType rBT = new randomBloodType();
  setBonus sB = new setBonus();
  characterDatabaseGenOne cD = new characterDatabaseGenOne();
  inheritance inh = new inheritance();

  genCharacter mother = cD.diadora;
  genCharacter father = cD.alvis;

  noWeaponStats n = new noWeaponStats();
  genItem nW = new genItem(n.allStats, n.remainingStats);
  loputousuStats l = new loputousuStats();
  genItem loputousu =
      new genItem(
          l.allStats,
          new boolean[] {
            true, false, false, false, false, false, false, false, false, false, false
          });
  maxStats mX = new maxStats();
  public int team = 2;
  public int characterID = 128;
  public int sex = 0;
  public int classID = 145;
  public int baseClass = 145;
  public int level = 20;
  public int maxLevel = 20;
  public int exp = 0;
  // Baldo, Odo, Hezul, Noba, Dain, Neir, Ulir, Blagi, Fala, Tordo, Holsety, Narga, Loputousu
  public int[] bloodTypePercents = inh.getBloodType(mother, father, sex);
  public int[] basePercents = inh.getGrowth(mother, father, sex);
  public int[] bonusPercents = rBT.getBloodPercent(bloodTypePercents);
  public int[] currentStats =
      inh.childStartingStats(
          mother, father, level, basePercents, bonusPercents, level, classID, sex);
  // 0->1 "-", 1->30 "D", 30->70 "C", 70->120 "B", 120->180 "A", 180->250 "S"
  public int[] weaponEXP = new int[] {0, 0, 0, 0, 0, 0, 121, 121, 121, 0, 251, 0};
  int[] defaultSkills = new int[] {3, 4, 6, 0, 0, 0};
  public int[] skills = inh.inheritSkill(mother, father, defaultSkills);
  public int[] skillList = fSL.getSkillList();
  public int kills = 0;
  public int gold = inh.getGold(mother, father);
  public int marriedID = 0;
  public int[] childOne = new int[] {-1, -1};
  public int[] childTwo = new int[] {-1, -1};
  public int[] childThree = new int[] {-1, -1};
  public boolean isLeader = false;
  public int leadershipStars = 5;
  public item[] weapons = new item[] {loputousu, nW, nW, nW, nW, nW, nW};

  public int[] bonusStats = sB.getBonus(skills, eW.getEquippedWeapon(weapons));
  public int attack = attackStat.getAttack(eW.getEquippedWeapon(weapons), currentStats, bonusStats);
  public int hit =
      hitStat.getHit(
          eW.getEquippedWeapon(weapons),
          currentStats[4],
          bonusStats[3],
          currentStats[6],
          bonusStats[5],
          skills);
  public int crit =
      criticalStat.getCritical(
          eW.getEquippedWeapon(weapons), currentStats[4], bonusStats[3], skills, kills);
  public int avoid =
      avoidStat.getAvoid(currentStats[5], bonusStats[4], currentStats[6], bonusStats[5], skills);
}
Exemple #28
0
 /**
  * The player received an attackMessage in a network game. This method sets the AttackingState and
  * initializes the attack.
  */
 public void receivedAttackMsg() {
   state = DynamicObjectState.Attacking;
   curAnim = simpleAttack.getAnimation(heading);
   manager.registerAttack(simpleAttack);
   simpleAttack.activate();
 }