Ejemplo n.º 1
1
  public static void addDebugModifications(Thing h) {
    h.set("IsImmortal", 1);
    h.set("IsDebugMode", 1);

    if ("QuickTester".equals(h.getString("HeroName"))) {
      h.addThing(Spell.create("Annihilation"));
      h.addThing(Spell.create("Blaze"));
      h.addThing(Spell.create("Ultimate Destruction"));
      Wish.makeWish("skills", 100);
    }
  }
Ejemplo n.º 2
0
  /**
   * Tries to cast the spell with the given index. Checks cooldown and manacosts.
   *
   * @param index
   */
  public void spellAttack(int index) {
    if (state == DynamicObjectState.Attacking) return;

    curAnim = idleAnim.get(heading);
    Vector2 spVelo = new Vector2();
    Vector2 startPos = new Vector2();
    if (heading == Heading.Right) {
      spVelo.x = spSpeed;
      startPos = new Vector2(collisionRect.x + collisionRect.width, collisionRect.y);
    } else if (heading == Heading.Left) {
      spVelo.x = -spSpeed;
      startPos = new Vector2(collisionRect.x - 32, collisionRect.y);
    } else if (heading == Heading.Up) {
      spVelo.y = -spSpeed;
      startPos = new Vector2(collisionRect.x, collisionRect.y - 32);
    } else {
      spVelo.y = spSpeed;
      startPos = new Vector2(collisionRect.x, collisionRect.y + (float) collisionRect.getHeight());
    }

    Spell curSpell = spellManager.getSpell(index);
    if (!curSpell.isOnCooldown() && mana.getCurrentMana() >= curSpell.getManaCost()) {
      mana.reduceMana(curSpell.getManaCost());
      manager.spawnSpell(curSpell.getProjectile(startPos, heading));
      spellManager.activate(index);
      if (isInNetwork && controllerActive) {
        NetworkManager.sendSpellMessage(this, index);
      }
    }
  }
Ejemplo n.º 3
0
 public SpellVariant(Spell spell) {
   this.spell = spell;
   this.name = spell.getName();
   this.category = spell.getCategory();
   this.description = spell.getDescription();
   this.material = spell.getMaterial();
   this.parameters = new String[0];
 }
Ejemplo n.º 4
0
  public void updateCurrentSpell(double date) {
    if (spells.size() > 0 && !Double.isNaN(currentDate)) {
      Spell s = spells.getLast();

      if (!s.closed) s.end = currentDate;
    }

    currentDate = date;
  }
Ejemplo n.º 5
0
  public void unInvoke() {
    // undo the affects of this spell
    if ((affected == null) || (!(affected instanceof MOB))) {
      super.unInvoke();
      return;
    }
    MOB mob = (MOB) affected;
    if (canBeUninvoked()) mob.tell("Your summoning ward dissipates.");

    super.unInvoke();
  }
Ejemplo n.º 6
0
  public Spell closeSpell() {
    if (spells.size() > 0) {
      Spell s = spells.getLast();

      if (!s.closed) {
        s.closed = true;
        return s;
      }
    }

    return null;
  }
  @Override
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) {
      super.unInvoke();
      return;
    }
    final MOB mob = (MOB) affected;
    if (canBeUninvoked()) mob.tell(L("Your teleportation ward dissipates."));

    super.unInvoke();
  }
Ejemplo n.º 8
0
  public void unInvoke() {
    // undo the affects of this spell
    if ((affected == null) || (!(affected instanceof MOB))) {
      super.unInvoke();
      return;
    }
    MOB mob = (MOB) affected;
    super.unInvoke();

    if (canBeUninvoked())
      if ((mob.location() != null) && (!mob.amDead()))
        mob.location().show(mob, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> fade(s) back into view.");
  }
Ejemplo n.º 9
0
  public void unInvoke() {
    if ((affected == null) || (!(affected instanceof MOB))) return;
    MOB mob = (MOB) affected;

    super.unInvoke();
    if (canBeUninvoked()) mob.tell("You begin to feel more like your regular cranky self.");
  }
Ejemplo n.º 10
0
  private void initSpell() {

    spell = SpellSet.getSpellSet().getSpell(spellNum);

    TextView word = (TextView) view.findViewById(R.id.word);
    final TextView belowTextView = (TextView) view.findViewById(R.id.below_text_view);
    final TextView spellOutput = (TextView) view.findViewById(R.id.spell_output);
    final EditText spellText = (EditText) view.findViewById(R.id.spell_text);
    Button submitButton = (Button) view.findViewById(R.id.spell_button);
    word.setText(spell.getWord());
    submitButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            final String input = spellText.getText().toString();
            if (input.equalsIgnoreCase(spell.getWord())) {
              spellText.setText("");
              belowTextView.setText(R.string.yay);
              spellOutput.setText(R.string.correct);
              spellOutput.setVisibility(View.VISIBLE);
            } else if (input.equals("")) {
              spellText.setText("");
              belowTextView.setText(R.string.error_below);
              spellOutput.setText(R.string.spell_blank_error);
              spellOutput.setVisibility(View.VISIBLE);
            } else {
              spellText.setText("");
              belowTextView.setText(R.string.not_spell_answer);
              spellOutput.setText(R.string.incorrect);
              spellOutput.setVisibility(View.VISIBLE);
            }
          }
        });
  }
Ejemplo n.º 11
0
 @Override
 public void affectCharStats(MOB affected, CharStats affectableStats) {
   super.affectCharStats(affected, affectableStats);
   affectableStats.setStat(
       CharStats.STAT_STRENGTH,
       (int) Math.round(CMath.div(affectableStats.getStat(CharStats.STAT_STRENGTH), 2.0)));
 }
Ejemplo n.º 12
0
 public void unInvoke() {
   if (!(affected instanceof MOB)) return;
   MOB mob = (MOB) affected;
   lastRoom = null;
   super.unInvoke();
   if (canBeUninvoked()) mob.tell("Your senses are no longer as dark.");
 }
Ejemplo n.º 13
0
 public void unInvoke() {
   // undo the affects of this spell
   MOB recheckMOB = null;
   if ((canBeUninvoked()) && (affected != null)) {
     if (affected instanceof MOB) {
       MOB mob = (MOB) affected;
       if ((mob.location() != null) && (!mob.amDead()))
         mob.location()
             .show(
                 mob, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> return(s) to <S-HIS-HER> normal size.");
       recheckMOB = mob;
     } else if (affected instanceof Item) {
       Item item = (Item) affected;
       if (item.owner() != null) {
         if (item.owner() instanceof Room)
           ((Room) item.owner())
               .showHappens(CMMsg.MSG_OK_VISUAL, item.name() + " returns to its proper size.");
         else if (item.owner() instanceof MOB) {
           ((MOB) item.owner()).tell(item.name() + " returns to its proper size.");
           recheckMOB = (MOB) item.owner();
         }
       }
     }
   }
   super.unInvoke();
   if (recheckMOB != null) CMLib.utensils().confirmWearability(recheckMOB);
 }
Ejemplo n.º 14
0
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    MOB mob = (MOB) affected;
    super.unInvoke();

    if (canBeUninvoked()) mob.tell("Your temporary advancement has receded.");
  }
Ejemplo n.º 15
0
 public void affectPhyStats(Physical affected, PhyStats affectableStats) {
   super.affectPhyStats(affected, affectableStats);
   // when this spell is on a MOBs Affected list,
   // it should consistantly put the mob into
   // a sleeping state, so that nothing they do
   // can get them out of it.
   affectableStats.setDisposition(affectableStats.disposition() | PhyStats.IS_INVISIBLE);
 }
Ejemplo n.º 16
0
 public void affectCharStats(MOB affected, CharStats affectableStats) {
   super.affectCharStats(affected, affectableStats);
   int str = affectableStats.getStat(CharStats.STAT_STRENGTH);
   int baseDex = affected.baseCharStats().getStat(CharStats.STAT_DEXTERITY);
   affectableStats.setStat(CharStats.STAT_STRENGTH, (str / 10) + 1);
   if (affectableStats.getStat(CharStats.STAT_DEXTERITY) <= baseDex + 5)
     affectableStats.setStat(CharStats.STAT_DEXTERITY, baseDex + 5);
 }
Ejemplo n.º 17
0
  @Override
  public void unInvoke() {
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;

    super.unInvoke();
    if (canBeUninvoked()) mob.tell(L("You begin to feel more like your regular cranky self."));
  }
  @Override
  public void unInvoke() {
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;

    super.unInvoke();
    if (canBeUninvoked()) mob.tell(L("Your sight becomes less keen."));
  }
Ejemplo n.º 19
0
  public void unInvoke() {
    // undo the affects of this spell
    if ((affected == null) || (!(affected instanceof MOB))) return;
    MOB mob = (MOB) affected;
    if (canBeUninvoked()) mob.tell("Your magic missile protection dissipates.");

    super.unInvoke();
  }
Ejemplo n.º 20
0
 @Override
 public void unInvoke() {
   final Physical affected = super.affected;
   super.unInvoke();
   if (canBeUninvoked()) {
     if (affected instanceof MOB) ((MOB) affected).tell(L("Your anti-plant shell fades."));
   }
 }
Ejemplo n.º 21
0
  public void unInvoke() {

    if ((canBeUninvoked())
        && (invoker() != null)
        && (affected != null)
        && (affected instanceof Room))
      invoker().tell("Your marker in '" + ((Room) affected).displayText() + "' dissipates.");
    super.unInvoke();
  }
Ejemplo n.º 22
0
  @Override
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;
    super.unInvoke();

    if (canBeUninvoked()) mob.tell(L("You begin to feel better."));
  }
Ejemplo n.º 23
0
  @Override
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;
    if (canBeUninvoked()) mob.tell(L("Your uninhibiting protection dissipates."));

    super.unInvoke();
  }
Ejemplo n.º 24
0
 @Override
 public void unInvoke() {
   if ((affected != null)
       && (affected instanceof Item)
       && (((Item) affected).owner() != null)
       && (((Item) affected).owner() instanceof Room))
     ((Room) ((Item) affected).owner())
         .showHappens(CMMsg.MSG_OK_ACTION, L("@x1 stops moving.", affected.name()));
   super.unInvoke();
 }
Ejemplo n.º 25
0
 @Test
 public void settersAndGettersWork() {
   spell.setCost(10);
   assertEquals(10, spell.getCost());
   spell.setDescription("whatever");
   assertEquals("whatever", spell.getDescription());
   spell.setDescription(null);
   assertEquals(Spell.NO_DESCRIPTION_VALUE, spell.getDescription());
 }
Ejemplo n.º 26
0
  @Override
  public void unInvoke() {
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;

    super.unInvoke();
    if (canBeUninvoked())
      if ((mob.location() != null) && (!mob.amDead()))
        mob.location()
            .show(
                mob,
                null,
                CMMsg.MSG_OK_VISUAL,
                L("<S-YOUPOSS> ability to breathe underwater fades."));
  }
Ejemplo n.º 27
0
  public boolean cast(String[] extraParameters, Player player) {
    String[] spellParameters = parameters;

    if (extraParameters.length > 0) {
      spellParameters = new String[extraParameters.length + parameters.length];
      for (int i = 0; i < parameters.length; i++) {
        spellParameters[i] = parameters[i];
      }
      for (int i = 0; i < extraParameters.length; i++) {
        spellParameters[i + parameters.length] = extraParameters[i];
      }
    }

    return spell.cast(spellParameters, player);
  }
Ejemplo n.º 28
0
  public void unInvoke() {
    // undo the affects of this spell
    if ((affected == null) || (!(affected instanceof MOB))) return;
    MOB mob = (MOB) affected;

    super.unInvoke();
    if (canBeUninvoked()) {
      mob.location()
          .show(
              mob,
              null,
              CMMsg.MSG_NOISYMOVEMENT,
              "<S-NAME> manage(s) to break <S-HIS-HER> way free of the repulsion field.");
      CMLib.commands().postStand(mob, true);
    }
  }
Ejemplo n.º 29
0
 @Override
 public void affectCharStats(MOB affected, CharStats affectableStats) {
   super.affectCharStats(affected, affectableStats);
   final int[] breatheables = affectableStats.getBreathables();
   if (breatheables.length == 0) return;
   if ((lastSet != breatheables) || (newSet == null)) {
     newSet =
         Arrays.copyOf(
             affectableStats.getBreathables(), affectableStats.getBreathables().length + 2);
     newSet[newSet.length - 1] = RawMaterial.RESOURCE_SALTWATER;
     newSet[newSet.length - 2] = RawMaterial.RESOURCE_FRESHWATER;
     Arrays.sort(newSet);
     lastSet = breatheables;
   }
   affectableStats.setBreathables(newSet);
 }
Ejemplo n.º 30
0
 public void unInvoke() {
   if ((canBeUninvoked()) && (affected != null)) {
     if (affected instanceof Exit) {
       Exit exit = (Exit) affected;
       exit.setDoorsNLocks(
           exit.hasADoor(),
           !exit.hasADoor(),
           exit.defaultsClosed(),
           exit.hasALock(),
           exit.hasALock(),
           exit.defaultsLocked());
     } else if (affected instanceof Container) {
       Container container = (Container) affected;
       container.setLidsNLocks(
           container.hasALid(), !container.hasALid(), container.hasALock(), container.hasALock());
     }
   }
   super.unInvoke();
 }