private int stealXP(Character target) {
   int xpStolen = target.getXP();
   if (xpStolen <= 0) {
     return 0;
   }
   target.loseXP(xpStolen);
   getSelf().gainXP(xpStolen);
   return xpStolen;
 }
Exemple #2
0
 public boolean end() {
   clear();
   p1.state = State.ready;
   p2.state = State.ready;
   p1.endofbattle();
   p2.endofbattle();
   location.endEncounter();
   boolean ding = false;
   while (p1.getXP() >= p1.getXPReqToNextLevel()) {
     p1.loseXP(p1.getXPReqToNextLevel());
     p1.ding();
     if (p1.human()) {
       ding = true;
     }
   }
   while (p2.getXP() >= p2.getXPReqToNextLevel()) {
     p2.loseXP(p2.getXPReqToNextLevel());
     p2.ding();
     if (p2.human()) {
       ding = true;
     }
   }
   return ding;
 }