Example #1
0
 protected boolean handleSpellFunction(Entity target) {
   if (!_spell.getCureCondition().equals(CureCondition.NONE)) {
     SpellCureCondition spellCureCondition = new SpellCureCondition(_entity, _room, _spell);
     return spellCureCondition.handleSpellFunction(target);
   } else {
     target.getVitality().addCurVitality(_spellResult.getNumberEffect());
   }
   return true;
 }
Example #2
0
  /**
   * PLAYER: &bYou intoned the spell for Minex which healed 6 damage! TARGET: &CHilorex just intoned
   * a minor healing spell for you which healed 6 damage! ROOM: &bHilorex just intoned a minor
   * healing spell for Hilorex!
   */
  protected void handleSingleTargetMessage(Entity target) {
    String messageToPlayer =
        MessageFormat.format(
            TaMessageManager.SPLHEL.getMessage(), target.getName(), _spellResult.getNumberEffect());
    String messageToVictim =
        MessageFormat.format(
            TaMessageManager.HELYOU.getMessage(),
            _entity.getName(),
            _spell.getMessage(),
            _spellResult.getNumberEffect());
    String messageToRoom =
        MessageFormat.format(
            TaMessageManager.HELOTH.getMessage(),
            _entity.getName(),
            _spell.getMessage(),
            target.getName());

    displayBeneficialMessages(messageToPlayer, messageToRoom, messageToVictim, target);
  }
Example #3
0
  /** &bYou performed a charm spell on the %s! Minex just performed a charm spell on the kobold! */
  protected void handleSingleTarget(Entity target) {
    // Can't charm arena mobs.
    if (RoomFlags.SAFE.isSet(_room.getRoomFlags()) || RoomFlags.ARENA.isSet(_room.getRoomFlags())) {
      _entity.print(TaMessageManager.NCSHER.getMessage());
      return;
    }

    // Can't charm players, though that would be cool.
    if (target.getEntityType().equals(EntityType.PLAYER)) {
      _entity.print(TaMessageManager.NOCHCH.getMessage());
      return;
    }

    // Random failure chance.
    if (!WorldManager.getGameMechanics().isCharmSpellSuccess(_entity, (Mob) target, _spell)) {
      handleUnsuccessfulSpell();
      return;
    }

    String messageToPlayer =
        MessageFormat.format(TaMessageManager.SPLCHM.getMessage(), target.getName());
    String messageToRoom =
        MessageFormat.format(
            TaMessageManager.CHMOTH.getMessage(),
            _entity.getName(),
            _spell.getMessage(),
            target.getName());

    _entity.print(messageToPlayer);
    _room.print(_entity, messageToRoom, false);

    // TODO - modify the mobs behavior here.
    // Place the summoned mob into the group.
    Entity groupLeader = _entity.getGroupLeader();
    if (groupLeader.equals(_entity)) {
      _entity.getGroupList().add(target);
      target.setGroupLeader(_entity);
    } else {
      groupLeader.getGroupList().add(target);
      target.setGroupLeader(groupLeader);
    }

    handleSpellSuccess();
  }