@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0), null); final CMMsg msg2 = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "" : L("^S<S-NAME> reach(es) at <T-NAMESELF>, @x1!^?", prayingWord(mob))); if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) { mob.location().send(mob, msg2); mob.location().send(mob, msg); if ((msg.value() <= 0) && (msg2.value() <= 0)) { final int damage = CMLib.dice().roll(1, adjustedLevel(mob, asLevel), 0); CMLib.combat() .postDamage( mob, target, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_UNDEAD, Weapon.TYPE_BURSTING, auto ? L("<T-NAME> shudder(s) in a draining magical wake.") : L("The draining grasp <DAMAGE> <T-NAME>.")); if (mob != target) CMLib.combat() .postHealing( mob, mob, this, CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL, damage, null); } } } else return maliciousFizzle( mob, target, L("<S-NAME> reach(es) for <T-NAMESELF>, @x1, but the spell fades.", prayingWord(mob))); // return whether it worked return success; }
@Override public boolean tick(Tickable ticking, int tickID) { if ((affected == null) || (!(affected instanceof Room))) return super.tick(ticking, tickID); if ((--damageTickDown) >= 0) return super.tick(ticking, tickID); damageTickDown = 4; HashSet H = null; if ((invoker() != null) && (invoker().location() == affected)) { H = new HashSet(); invoker().getGroupMembers(H); } final Room R = (Room) affected; for (int i = 0; i < R.numInhabitants(); i++) { final MOB M = R.fetchInhabitant(i); if ((M != null) && ((H == null) || (!H.contains(M)))) { if (invoker() != null) { final int harming = CMLib.dice().roll(1, adjustedLevel(invoker(), 0) / 3, 1); CMLib.combat() .postDamage( invoker(), M, this, harming, CMMsg.MASK_MALICIOUS | CMMsg.TYP_UNDEAD, Weapon.TYPE_BURSTING, L("The unholy aura <DAMAGE> <T-NAME>!")); } else { final int harming = CMLib.dice().roll(1, CMLib.ableMapper().lowestQualifyingLevel(ID()) / 3, 1); CMLib.combat() .postDamage( M, M, this, harming, CMMsg.MASK_MALICIOUS | CMMsg.TYP_UNDEAD, Weapon.TYPE_BURSTING, L("The unholy aura <DAMAGE> <T-NAME>!")); } if ((!M.isInCombat()) && (M.isMonster()) && (M != invoker) && (invoker != null) && (M.location() == invoker.location()) && (M.location().isInhabitant(invoker)) && (CMLib.flags().canBeSeenBy(invoker, M))) CMLib.combat().postAttack(M, invoker, M.fetchWieldedItem()); } } return super.tick(ticking, tickID); }
@Override public void spring(MOB M) { if ((!sprung) && (CMLib.dice().rollPercentage() + (2 * getXLEVELLevel(invoker())) > M.charStats().getSave(CharStats.STAT_SAVE_TRAPS))) CMLib.combat().postDeath(invoker(), M, null); }
@Override public boolean tick(Tickable ticking, int tickID) { if (!super.tick(ticking, tickID)) return false; if ((tickID == Tickable.TICKID_MOB) && (ticking instanceof MOB)) CMLib.combat().recoverTick((MOB) ticking); return true; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; // now see if it worked final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, somanticCastCode(mob, target, auto), L( (auto ? "A " : "^S<S-NAME> incant(s) and point(s) at <T-NAMESELF>. A ") + "long shard of ice streaks through the air!^?") + CMLib.protocol().msp("spelldam2.wav", 40)); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_COLD | (auto ? CMMsg.MASK_ALWAYS : 0), null); if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) { mob.location().send(mob, msg); invoker = mob; int damage = 0; final int maxDie = (adjustedLevel(mob, asLevel) + (2 * super.getX1Level(mob))) / 2; damage += CMLib.dice().roll(maxDie, 6, 15); mob.location().send(mob, msg2); if ((msg2.value() > 0) || (msg.value() > 0)) damage = (int) Math.round(CMath.div(damage, 2.0)); if (target.location() == mob.location()) CMLib.combat() .postDamage( mob, target, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_COLD, Weapon.TYPE_FROSTING, L("The lance <DAMAGE> <T-NAME>!")); } } else return maliciousFizzle( mob, target, L("<S-NAME> incant(s) and point(s) at <T-NAMESELF>, but flub(s) the spell.")); // return whether it worked return success; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; final boolean undead = CMLib.flags().isUndead(target); if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, (undead ? 0 : CMMsg.MASK_MALICIOUS) | verbalCastCode(mob, target, auto), L( auto ? "A seriously painful burst assaults <T-NAME>." : "^S<S-NAME> " + prayWord(mob) + " for a serious burst of pain at <T-NAMESELF>!^?") + CMLib.protocol().msp("spelldam1.wav", 40)); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0), null); final Room R = target.location(); if ((R != null) && (R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) { R.send(mob, msg); R.send(mob, msg2); if ((msg.value() <= 0) && (msg2.value() <= 0)) { final int harming = CMLib.dice().roll(1, adjustedLevel(mob, asLevel) + 6, 4); CMLib.combat() .postDamage( mob, target, this, harming, CMMsg.MASK_ALWAYS | CMMsg.TYP_UNDEAD, Weapon.TYPE_BURSTING, L("The unholy spell <DAMAGE> <T-NAME>!")); } } } else return maliciousFizzle( mob, target, L("<S-NAME> point(s) at <T-NAMESELF> and @x1, but nothing happens.", prayWord(mob))); // return whether it worked return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; Room R = CMLib.map().roomLocation(target); if (R == null) R = mob.location(); if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, somanticCastCode(mob, target, auto), L( auto ? "<T-NAME> <T-IS-ARE> sprayed with acid." : "^S<S-NAME> reach(es) for <T-NAMESELF>, spraying acid all over <T-HIM-HER>!^?") + CMLib.protocol().msp("spelldam1.wav", 40)); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_ACID | (auto ? CMMsg.MASK_ALWAYS : 0), null); if ((R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) { R.send(mob, msg); R.send(mob, msg2); invoker = mob; final int numDice = (adjustedLevel(mob, asLevel) + (2 * super.getX1Level(invoker()))) / 2; int damage = CMLib.dice().roll(2, numDice, 1); if ((msg2.value() > 0) || (msg.value() > 0)) damage = (int) Math.round(CMath.div(damage, 2.0)); CMLib.combat() .postDamage( mob, target, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID, Weapon.TYPE_MELTING, L("The acid <DAMAGE> <T-NAME>!")); maliciousAffect(mob, target, asLevel, 3, -1); } } else return maliciousFizzle( mob, target, L("<S-NAME> reach(es) for <T-NAMESELF>, but nothing more happens.")); return success; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); final Room R = target.location(); if (success) { final Prayer_Thunderbolt newOne = (Prayer_Thunderbolt) this.copyOf(); final CMMsg msg = CMClass.getMsg( mob, target, newOne, verbalCastCode(mob, target, auto), L( auto ? "<T-NAME> is filled with a holy charge!" : "^S<S-NAME> " + prayForWord(mob) + " to strike down <T-NAMESELF>!^?") + CMLib.protocol().msp("lightning.wav", 40)); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_ELECTRIC | (auto ? CMMsg.MASK_ALWAYS : 0), null); if ((R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) { R.send(mob, msg); R.send(mob, msg2); if ((msg.value() <= 0) && (msg2.value() <= 0)) { final int harming = CMLib.dice().roll(1, adjustedLevel(mob, asLevel), adjustedLevel(mob, asLevel)); CMLib.combat() .postDamage( mob, target, this, harming, CMMsg.MASK_ALWAYS | CMMsg.TYP_ELECTRIC, Weapon.TYPE_STRIKING, L("^SThe STRIKE of @x1 <DAMAGES> <T-NAME>!^?", hisHerDiety(mob))); } } } else return maliciousFizzle(mob, target, L("<S-NAME> @x1, but nothing happens.", prayWord(mob))); // return whether it worked return success; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if (!mob.isInCombat()) { mob.tell(L("You must be in combat to do this!")); return false; } final MOB victim = super.getTarget(mob, commands, givenTarget); if (victim == null) return false; if (((victim == mob.getVictim()) && (mob.rangeToTarget() > 0)) || ((victim.getVictim() == mob) && (victim.rangeToTarget() > 0))) { mob.tell(L("You are too far away to disarm!")); return false; } if (mob.fetchWieldedItem() == null) { mob.tell(L("You need a weapon to disarm someone!")); return false; } Item hisWeapon = victim.fetchWieldedItem(); if (hisWeapon == null) hisWeapon = victim.fetchHeldItem(); if ((hisWeapon == null) || (!(hisWeapon instanceof Weapon)) || ((((Weapon) hisWeapon).weaponClassification() == Weapon.CLASS_NATURAL))) { mob.tell(L("@x1 is not wielding a weapon!", victim.charStats().HeShe())); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; int levelDiff = victim.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob))); if (levelDiff > 0) levelDiff = levelDiff * 5; else levelDiff = 0; final boolean hit = (auto) || CMLib.combat().rollToHit(mob, victim); final boolean success = proficiencyCheck(mob, -levelDiff, auto) && (hit); if ((success) && ((hisWeapon.fitsOn(Wearable.WORN_WIELD)) || hisWeapon.fitsOn(Wearable.WORN_WIELD | Wearable.WORN_HELD))) { if (mob.location().show(mob, victim, this, CMMsg.MSG_NOISYMOVEMENT, null)) { final CMMsg msg = CMClass.getMsg(victim, hisWeapon, null, CMMsg.MSG_DROP, null); if (mob.location().okMessage(mob, msg)) { mob.location().send(victim, msg); mob.location() .show( mob, victim, CMMsg.MSG_NOISYMOVEMENT, auto ? L("<T-NAME> is disarmed!") : L("<S-NAME> disarm(s) <T-NAMESELF>!")); } } } else maliciousFizzle(mob, victim, L("<S-NAME> attempt(s) to disarm <T-NAMESELF> and fail(s)!")); return success; }
@Override public boolean tick(Tickable ticking, int tickID) { if (!(affected instanceof MOB)) return super.tick(ticking, tickID); final MOB mob = (MOB) affected; if (tickID != Tickable.TICKID_MOB) return true; if (!proficiencyCheck(null, 0, false)) return true; if ((!mob.isInCombat()) && (CMLib.flags().isSleeping(mob))) { roundsHibernating++; final double man = ((mob.charStats().getStat(CharStats.STAT_INTELLIGENCE) + mob.charStats().getStat(CharStats.STAT_WISDOM))); mob.curState() .adjMana( (int) Math.round( (man * .1) + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker()))) / 2.0)), mob.maxState()); mob.curState().setHunger(oldState.getHunger()); mob.curState().setThirst(oldState.getThirst()); final double move = mob.charStats().getStat(CharStats.STAT_STRENGTH); mob.curState() .adjMovement( (int) Math.round( (move * .1) + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker()))) / 2.0)), mob.maxState()); if (!CMLib.flags().isGolem(mob)) { final double hp = mob.charStats().getStat(CharStats.STAT_CONSTITUTION); if (!CMLib.combat() .postHealing( mob, mob, this, CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL, (int) Math.round( (hp * .1) + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker()))) / 2.0)), null)) unInvoke(); } } else { unInvoke(); return false; } return super.tick(ticking, tickID); }
@Override public void spring(MOB mob) { final Room room = mob.location(); if (room != null) { final Set<MOB> friendlySet = new HashSet<MOB>(); if (invoker() != null) invoker().getGroupMembers(friendlySet); room.show( mob, affected, CMMsg.MSG_OK_ACTION, L("<T-NAME> explodes, spraying clumps of stomach acid everywhere!")); for (final Enumeration<MOB> m = room.inhabitants(); m.hasMoreElements(); ) { MOB M = m.nextElement(); if ((M != null) && (!friendlySet.contains(M))) { final MOB invoker = (invoker() != null) ? invoker() : M; final int damage = CMLib.dice().roll(4, 5 + invoker.phyStats().level(), 0); CMLib.combat() .postDamage( invoker, M, this, damage, CMMsg.MASK_MALICIOUS | CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID, Weapon.TYPE_MELTING, L("The acid clumps <DAMAGE> <T-NAME>!")); if ((!M.isInCombat()) && (M.isMonster()) && (M != invoker) && (M.location() == invoker.location()) && (M.location().isInhabitant(invoker)) && (CMLib.flags().canBeSeenBy(invoker, M))) CMLib.combat().postAttack(M, invoker, M.fetchWieldedItem()); } } } Physical affected = this.affected; unInvoke(); if (affected instanceof Item) ((Item) affected).destroy(); }
@Override public void affectPhyStats(Physical affected, PhyStats affectableStats) { super.affectPhyStats(affected, affectableStats); if (affected == null) return; if (levelsDown < 0) return; final int attacklevel = affectableStats.attackAdjustment() / affectableStats.level(); affectableStats.setLevel(affectableStats.level() - (levelsDown * direction)); if (affectableStats.level() <= 0) { levelsDown = -1; CMLib.combat().postDeath(invoker(), (MOB) affected, null); } affectableStats.setAttackAdjustment( affectableStats.attackAdjustment() - (attacklevel * (levelsDown * direction))); }
@Override public boolean tick(Tickable ticking, int tickID) { if (tickID != Tickable.TICKID_MISCELLANEOUS) return super.tick(ticking, tickID); while (killTrigger[0]) { final LinkedList<MOB> killThese = new LinkedList<MOB>(); synchronized (killTrigger) { killThese.addAll(getDeadMOBsFrom(affected)); killTrigger[0] = false; } for (final MOB M : killThese) { CMLib.combat().postDeath(null, M, null); } } return false; }
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if ((msg.targetMinor() == CMMsg.TYP_ENTER) && (msg.target() == affected) && (msg.source() != invoker()) && (!msg.source().Name().equals(text())) && (!sprung) && (invoker() != null) && (invoker().mayIFight(msg.source())) && ((canBeUninvoked()) || (!CMLib.law().doesHavePriviledgesHere(msg.source(), (Room) affected))) && (CMLib.dice().rollPercentage() > msg.source().charStats().getSave(CharStats.STAT_SAVE_TRAPS))) CMLib.combat().postDeath(invoker(), msg.source(), msg); super.executeMsg(myHost, msg); }
public void tickLycanthropically(MOB mob) { if (mob == null) return; if (mob.location() == null) return; if (mob.isInCombat()) return; if ((CMLib.dice().rollPercentage() < 15) && ((mob.location().domainType() & Room.INDOORS) > 0)) mob.location() .show(mob, null, CMMsg.MSG_NOISE, L("<S-NAME> howl(s) at the moon! ARROOOOOOOO!!!!")); // time to tick lycanthropically final MOB M = victimHere(mob.location(), mob); if (M != null) { deathTrail = null; CMLib.combat().postAttack(mob, M, mob.fetchWieldedItem()); return; } if ((deathTrail != null) && (!deathTrail.contains(mob.location()))) deathTrail = null; if (deathTrail == null) { final Vector rooms = new Vector(); if ((findVictim(mob, mob.location(), rooms, 0)) && (rooms.size() > 0)) { TrackingLibrary.TrackingFlags flags; flags = new TrackingLibrary.TrackingFlags() .plus(TrackingLibrary.TrackingFlag.OPENONLY) .plus(TrackingLibrary.TrackingFlag.AREAONLY) .plus(TrackingLibrary.TrackingFlag.NOEMPTYGRIDS) .plus(TrackingLibrary.TrackingFlag.NOAIR) .plus(TrackingLibrary.TrackingFlag.NOWATER); deathTrail = CMLib.tracking().findBastardTheBestWay(mob.location(), rooms, flags, 50); if (deathTrail != null) deathTrail.add(mob.location()); } } if (deathTrail != null) { final int nextDirection = CMLib.tracking().trackNextDirectionFromHere(deathTrail, mob.location(), true); if ((nextDirection == 999) || (nextDirection == -1)) deathTrail = null; else if (nextDirection >= 0) { final Room nextRoom = mob.location().getRoomInDir(nextDirection); if ((nextRoom != null) && ((nextRoom.getArea() == mob.location().getArea())) || (!mob.isMonster())) { if (!CMLib.tracking().walk(mob, nextDirection, false, false)) deathTrail = null; else if (CMLib.dice().rollPercentage() < 15) mob.location().show(mob, null, CMMsg.MSG_NOISE, L("<S-NAME> sniff(s) at the air.")); } else deathTrail = null; } } }
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost, msg); if ((msg.source().location() != null) && (msg.targetMinor() == CMMsg.TYP_DAMAGE) && ((msg.value()) > 0) && (msg.tool() == this) && (msg.target() instanceof MOB) && (!((MOB) msg.target()).amDead()) && (CMLib.flags().isEvil((MOB) msg.target()))) { final CMMsg msg2 = CMClass.getMsg( msg.source(), msg.target(), new HolyAvenger(), CMMsg.MSG_OK_ACTION, CMMsg.MSK_MALICIOUS_MOVE | CMMsg.TYP_UNDEAD, CMMsg.MSG_NOISYMOVEMENT, null); if (msg.source().location().okMessage(msg.source(), msg2)) { msg.source().location().send(msg.source(), msg2); int damage = CMLib.dice().roll(1, 15, 0); if (msg.value() > 0) damage = damage / 2; msg.addTrailerMsg( CMClass.getMsg( msg.source(), msg.target(), CMMsg.MSG_OK_ACTION, L( "@x1 dispels evil within <T-NAME> and @x2 <T-HIM-HER>>!", name(), CMLib.combat().standardHitWord(Weapon.TYPE_BURSTING, damage)))); final CMMsg msg3 = CMClass.getMsg( msg.source(), msg.target(), null, CMMsg.MSG_OK_VISUAL, CMMsg.MSG_DAMAGE, CMMsg.NO_EFFECT, null); msg3.setValue(damage); msg.addTrailerMsg(msg3); } } }
public boolean tick(Tickable ticking, int tickID) { if (!super.tick(ticking, tickID)) return false; if (affected == null) return false; if (!(affected instanceof MOB)) return true; MOB mob = (MOB) affected; MOB diseaser = invoker; if (diseaser == null) diseaser = mob; if ((!mob.amDead()) && ((--diseaseTick) <= 0)) { diseaseTick = DISEASE_DELAY(); mob.location().show(mob, null, CMMsg.MSG_NOISE, DISEASE_AFFECT()); int damage = CMLib.dice().roll(2, diseaser.envStats().level() + 1, 1); if (CMLib.dice().rollPercentage() == 1) damage += CMLib.dice().roll(10, 10, 1); CMLib.combat() .postDamage(diseaser, mob, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_DISEASE, -1, null); catchIt(mob); return true; } return true; }
@Override public boolean tick(Tickable ticking, int tickID) { if (!(affected instanceof MOB)) return super.tick(ticking, tickID); if (!super.tick(ticking, tickID)) return false; if ((--plagueDown) <= 0) { final MOB mob = (MOB) affected; plagueDown = 10; if (invoker == null) invoker = mob; drawups += .1; if (drawups >= 3.1) { if ((mob.location() != null) && (CMLib.flags().isInTheGame(mob, false))) { mob.location().show(mob, null, CMMsg.MSG_OK_VISUAL, L("<S-YOU-POSS> feet rot off!")); final Ability A = CMClass.getAbility("Amputation"); if (A != null) { int x = 100; while (((--x) > 0) && A.invoke(mob, CMParms.parse("foot"), mob, true, 0)) { /*do nothing */ } mob.recoverCharStats(); mob.recoverPhyStats(); mob.recoverMaxState(); } unInvoke(); } } else { final MOB invoker = (invoker() != null) ? invoker() : mob; CMLib.combat() .postDamage( invoker, mob, this, 1, CMMsg.TYP_DISEASE, -1, L( "<T-NAME> feel(s) the fungus between <T-HIS-HER> toes eating <T-HIS-HER> feet away!")); } } return true; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if ((!target.charStats().getMyRace().racialCategory().equals("Earth Elemental")) && (!target.charStats().getMyRace().racialCategory().equals("Stone Golem")) && (!target.charStats().getMyRace().racialCategory().equals("Metal Golem"))) { mob.tell(L("@x1 is not an stone/metal golem or earth elemental!", target.name(mob))); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; // now see if it worked boolean success = proficiencyCheck(mob, 0, auto); if (success) { final String str = auto ? "" : L("^S<S-NAME> chant(s) at <T-NAMESELF>.^?"); final CMMsg msg = CMClass.getMsg(mob, target, this, verbalCastCode(mob, target, auto), str); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (msg.value() <= 0) { success = maliciousAffect(mob, target, asLevel, 0, -1) != null; if (success) { if (target.isInCombat()) target.makePeace(); CMLib.commands().postFollow(target, mob, false); CMLib.combat().makePeaceInGroup(mob); if (target.amFollowing() != mob) mob.tell(L("@x1 seems unwilling to follow you.", target.name(mob))); } } } } if (!success) return maliciousFizzle( mob, target, L("<S-NAME> chant(s) at <T-NAMESELF>, but nothing happens.")); // return whether it worked return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success && (target.phyStats().level() < ((mob.phyStats().level() + super.getXLEVELLevel(mob)) / 2))) { final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto) | CMMsg.MASK_MALICIOUS, L("^S<S-NAME> @x1 for <T-NAME> to die.^?", prayForWord(mob))); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); CMLib.combat().postDeath(target, target, null); DeadBody body = null; for (Enumeration<Item> i = mob.location().items(); i.hasMoreElements(); ) { final Item I = i.nextElement(); if ((I instanceof DeadBody) && (((DeadBody) I).getMobName().equals(target.Name()))) body = (DeadBody) I; } if (body == null) mob.tell(L("The death did not appear to create a body!")); else beneficialAffect(mob, body, asLevel, 0); } } else return maliciousFizzle( mob, target, L("^S<S-NAME> @x1 <T-NAME> to die, but nothing happens.^?", prayForWord(mob))); // return whether it worked return success; }
public void extinguish(MOB source, Environmental target, boolean mundane) { if (target instanceof Room) { Room R = (Room) target; for (int m = 0; m < R.numInhabitants(); m++) { MOB M = R.fetchInhabitant(m); if (M != null) extinguish(source, M, mundane); } for (int i = 0; i < R.numItems(); i++) { Item I = R.fetchItem(i); if (I != null) extinguish(source, I, mundane); } return; } for (int a = target.numEffects() - 1; a >= 0; a--) { Ability A = target.fetchEffect(a); if ((A != null) && ((!mundane) || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_PROPERTY))) { if ((CMath.bset(A.flags(), Ability.FLAG_HEATING) && (!mundane)) || (CMath.bset(A.flags(), Ability.FLAG_FIREBASED)) || ((A.ID().equalsIgnoreCase("Spell_SummonElemental") && A.text().toUpperCase().indexOf("FIRE") >= 0))) A.unInvoke(); } } if ((target instanceof MOB) && (!mundane)) { MOB tmob = (MOB) target; if (tmob.charStats().getMyRace().ID().equals("FireElemental")) CMLib.combat().postDeath(source, (MOB) target, null); for (int i = 0; i < tmob.inventorySize(); i++) { Item I = tmob.fetchInventory(i); if (I != null) extinguish(tmob, I, mundane); } } if ((target instanceof Light) && (((Light) target).isLit())) { ((Light) target).tick(target, Tickable.TICKID_LIGHT_FLICKERS); ((Light) target).light(false); } }
@Override public void spring(MOB target) { if ((target != invoker()) && (target.location() != null)) { if ((!invoker().mayIFight(target)) || (isLocalExempt(target)) || (invoker().getGroupMembers(new HashSet<MOB>()).contains(target)) || (target == invoker()) || (doesSaveVsTraps(target))) target .location() .show( target, null, null, CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE, L("<S-NAME> avoid(s) setting off a sparking trap!")); else if (target .location() .show( target, target, this, CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE, L("<S-NAME> set(s) off an sparking trap!"))) { super.spring(target); CMLib.combat() .postDamage( invoker(), target, null, CMLib.dice().roll(trapLevel() + abilityCode(), 8, 1), CMMsg.MASK_ALWAYS | CMMsg.TYP_FIRE, Weapon.TYPE_BURNING, L("The sparks <DAMAGE> <T-NAME>!@x1", CMLib.protocol().msp("shock.wav", 30))); if ((canBeUninvoked()) && (affected instanceof Item)) disable(); } } }
@Override public boolean tick(Tickable ticking, int tickID) { if ((tickID == Tickable.TICKID_MOB) && (affected instanceof MOB)) { final MOB vic = (MOB) affected; if ((!vic.amDead()) && (vic.location() != null)) { final MOB invoker = (invoker() != null) ? invoker() : vic; CMLib.combat() .postDamage( invoker, vic, this, CMLib.dice() .roll( 1, 10 + super.getXLEVELLevel(invoker()) + (2 * super.getX1Level(invoker())), 0), CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID, -1, L("<T-NAME> sizzle(s) from the acid!")); } } return super.tick(ticking, tickID); }
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if (!super.okMessage(myHost, msg)) return false; if (!(affected instanceof MOB)) return true; final MOB mob = (MOB) affected; if ((msg.amITarget(mob)) && (msg.sourceMinor() == CMMsg.TYP_FIRE) && (msg.targetMinor() == CMMsg.TYP_DAMAGE)) { final int recovery = (int) Math.round(CMath.div((msg.value()), 2.0)); mob.location() .show( mob, null, CMMsg.MSG_OK_VISUAL, L("The flame attack heals <S-NAME> @x1 points.", "" + recovery)); CMLib.combat() .postHealing(mob, mob, this, recovery, CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL, null); return false; } return true; }
public static String getBasic(MOB M, int i) { StringBuffer str = new StringBuffer(""); switch (i) { case 0: str.append(M.Name() + ", "); break; case 1: str.append(M.description() + ", "); break; case 2: if (M.playerStats() != null) str.append(CMLib.time().date2String(M.playerStats().lastDateTime()) + ", "); break; case 3: if (M.playerStats() != null) str.append(M.playerStats().getEmail() + ", "); break; case 4: str.append(M.baseCharStats().getMyRace().name() + ", "); break; case 5: str.append( M.baseCharStats().getCurrentClass().name(M.baseCharStats().getCurrentClassLevel()) + ", "); break; case 6: str.append(M.baseEnvStats().level() + ", "); break; case 7: str.append(M.baseCharStats().displayClassLevel(M, true) + ", "); break; case 8: str.append(M.baseCharStats().getClassLevel(M.baseCharStats().getCurrentClass()) + ", "); break; case 9: { for (int c = M.charStats().numClasses() - 1; c >= 0; c--) { CharClass C = M.charStats().getMyClass(c); str.append( C.name(M.baseCharStats().getCurrentClassLevel()) + " (" + M.charStats().getClassLevel(C) + ") "); } str.append(", "); break; } case 10: if (M.maxCarry() > (Integer.MAX_VALUE / 3)) str.append("NA, "); else str.append(M.maxCarry() + ", "); break; case 11: str.append(CMStrings.capitalizeAndLower(CMLib.combat().fightingProwessStr(M)) + ", "); break; case 12: str.append(CMStrings.capitalizeAndLower(CMLib.combat().armorStr(M)) + ", "); break; case 13: str.append(CMLib.combat().adjustedDamage(M, null, null) + ", "); break; case 14: str.append(Math.round(CMath.div(M.getAgeHours(), 60.0)) + ", "); break; case 15: str.append(M.getPractices() + ", "); break; case 16: str.append(M.getExperience() + ", "); break; case 17: if (M.getExpNeededLevel() == Integer.MAX_VALUE) str.append("N/A, "); else str.append(M.getExpNextLevel() + ", "); break; case 18: str.append(M.getTrains() + ", "); break; case 19: str.append(CMLib.beanCounter().getMoney(M) + ", "); break; case 20: str.append(M.getWorshipCharID() + ", "); break; case 21: str.append(M.getLiegeID() + ", "); break; case 22: str.append(M.getClanID() + ", "); break; case 23: if (M.getClanID().length() > 0) { Clan C = CMLib.clans().getClan(M.getClanID()); if (C != null) str.append( CMLib.clans().getRoleName(C.getGovernment(), M.getClanRole(), true, false) + ", "); } break; case 24: str.append(M.fetchFaction(CMLib.factions().AlignID()) + ", "); break; case 25: { Faction.FactionRange FR = CMLib.factions() .getRange(CMLib.factions().AlignID(), M.fetchFaction(CMLib.factions().AlignID())); if (FR != null) str.append(FR.name() + ", "); else str.append(M.fetchFaction(CMLib.factions().AlignID())); break; } case 26: str.append(M.getWimpHitPoint() + ", "); break; case 27: if (M.getStartRoom() != null) str.append(M.getStartRoom().displayText() + ", "); break; case 28: if (M.location() != null) str.append(M.location().displayText() + ", "); break; case 29: if (M.getStartRoom() != null) str.append(M.getStartRoom().roomID() + ", "); break; case 30: if (M.location() != null) str.append(M.location().roomID() + ", "); break; case 31: { for (int inv = 0; inv < M.inventorySize(); inv++) { Item I = M.fetchInventory(inv); if ((I != null) && (I.container() == null)) str.append(I.name() + ", "); } break; } case 32: str.append(M.baseEnvStats().weight() + ", "); break; case 33: str.append(M.envStats().weight() + ", "); break; case 34: str.append(CMStrings.capitalizeAndLower(M.baseCharStats().genderName()) + ", "); break; case 35: if (M.playerStats() != null) str.append(M.playerStats().lastDateTime() + ", "); break; case 36: str.append(M.curState().getHitPoints() + ", "); break; case 37: str.append(M.curState().getMana() + ", "); break; case 38: str.append(M.curState().getMovement() + ", "); break; case 39: if (M.riding() != null) str.append(M.riding().name() + ", "); break; case 40: str.append(M.baseEnvStats().height() + ", "); break; case 41: if (!M.isMonster()) str.append(M.session().getAddress() + ", "); else if (M.playerStats() != null) str.append(M.playerStats().lastIP() + ", "); break; case 42: str.append(M.getQuestPoint() + ", "); break; case 43: str.append(M.maxState().getHitPoints() + ", "); break; case 44: str.append(M.maxState().getMana() + ", "); break; case 45: str.append(M.maxState().getMovement() + ", "); break; case 46: str.append(M.rawImage() + ", "); break; case 47: str.append(M.maxItems() + ", "); break; case 48: { String[] paths = CMProps.mxpImagePath(M.image()); if (paths[0].length() > 0) str.append(paths[0] + paths[1] + ", "); break; } case 49: if (CMProps.mxpImagePath(M.image())[0].length() > 0) str.append("true, "); else str.append("false, "); break; case 50: if (M.playerStats() != null) str.append(M.playerStats().notes() + ", "); break; case 51: if (M.playerStats() != null) { long lastDateTime = -1; for (int level = 0; level <= M.envStats().level(); level++) { long dateTime = M.playerStats().leveledDateTime(level); if ((dateTime > 1529122205) && (dateTime != lastDateTime)) { str.append("<TR>"); if (level == 0) str.append("<TD><FONT COLOR=WHITE>Created</FONT></TD>"); else str.append("<TD><FONT COLOR=WHITE>" + level + "</FONT></TD>"); str.append( "<TD><FONT COLOR=WHITE>" + CMLib.time().date2String(dateTime) + "</FONT></TD></TR>"); } } str.append(", "); } break; case 52: str.append(M.baseEnvStats().attackAdjustment() + ", "); break; case 53: str.append(M.baseEnvStats().damage() + ", "); break; case 54: str.append(M.baseEnvStats().armor() + ", "); break; case 55: str.append(M.envStats().speed() + ", "); break; case 56: str.append(M.baseEnvStats().speed() + ", "); break; case 57: { for (int e = 0; e < M.numExpertises(); e++) { String E = M.fetchExpertise(e); ExpertiseLibrary.ExpertiseDefinition X = CMLib.expertises().getDefinition(E); if (X == null) str.append(E + ", "); else str.append(X.name + ", "); } break; } case 58: { for (int t = 0; t < M.numTattoos(); t++) { String E = M.fetchTattoo(t); str.append(E + ", "); } break; } case 59: { if (M.playerStats() != null) for (int b = 0; b < M.playerStats().getSecurityGroups().size(); b++) { String B = (String) M.playerStats().getSecurityGroups().elementAt(b); if (B != null) str.append(B + ", "); } break; } case 60: { if (M.playerStats() != null) for (int b = 0; b < M.playerStats().getTitles().size(); b++) { String B = (String) M.playerStats().getTitles().elementAt(b); if (B != null) str.append(B + ", "); } break; } case 61: { for (Enumeration e = M.fetchFactions(); e.hasMoreElements(); ) { String FID = (String) e.nextElement(); Faction F = CMLib.factions().getFaction(FID); int value = M.fetchFaction(FID); if (F != null) str.append(F.name() + " (" + value + "), "); } break; } case 62: str.append(CMProps.getBoolVar(CMProps.SYSTEMB_ACCOUNTEXPIRATION) ? "true" : "false"); break; case 63: if (M.playerStats() != null) str.append(CMLib.time().date2String(M.playerStats().getAccountExpiration())); break; case 64: { for (int f = 0; f < M.numFollowers(); f++) str.append(M.fetchFollower(f).name()).append(", "); // Vector V=CMLib.database().DBScanFollowers(M); // for(int v=0;v<V.size();v++) // str.append(((MOB)V.elementAt(v)).name()).append(", "); break; } case 65: if ((M.playerStats() != null) && (M.playerStats().getAccount() != null)) str.append(M.playerStats().getAccount().accountName()); break; } return str.toString(); }
@Override public boolean tick(Tickable ticking, int tickID) { if ((affected != null) && (affected instanceof Item) && (((Item) affected).owner() != null) && (((Item) affected).owner() instanceof Room) && (invoker() != null) && (invoker().location().isContent((Item) affected))) { if (invoker().isInCombat()) { final boolean isHit = (CMLib.combat() .rollToHit( CMLib.combat().adjustedAttackBonus(invoker(), invoker().getVictim()) + ((Item) affected).phyStats().attackAdjustment(), CMLib.combat().adjustedArmor(invoker().getVictim()), 0)); if ((!isHit) || (!(affected instanceof Weapon))) invoker() .location() .show( invoker(), invoker().getVictim(), affected, CMMsg.MSG_OK_ACTION, L("<O-NAME> attacks <T-NAME> and misses!")); else CMLib.combat() .postDamage( invoker(), invoker().getVictim(), affected, CMLib.dice().roll(1, affected.phyStats().damage(), 5), CMMsg.MASK_ALWAYS | CMMsg.TYP_WEAPONATTACK, ((Weapon) affected).weaponType(), L("@x1 attacks and <DAMAGE> <T-NAME>!", affected.name())); } else if (CMLib.dice().rollPercentage() > 75) switch (CMLib.dice().roll(1, 5, 0)) { case 1: invoker() .location() .showHappens(CMMsg.MSG_OK_VISUAL, L("@x1 twiches a bit.", affected.name())); break; case 2: invoker() .location() .showHappens( CMMsg.MSG_OK_VISUAL, L("@x1 is looking for trouble.", affected.name())); break; case 3: invoker() .location() .showHappens(CMMsg.MSG_OK_VISUAL, L("@x1 practices its moves.", affected.name())); break; case 4: invoker() .location() .showHappens( CMMsg.MSG_OK_VISUAL, L("@x1 makes a few fake attacks.", affected.name())); break; case 5: invoker() .location() .showHappens(CMMsg.MSG_OK_VISUAL, L("@x1 dances around.", affected.name())); break; } } else unInvoke(); return super.tick(ticking, tickID); }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = super.getTarget(mob, commands, givenTarget); if (target == null) return false; final Race R = target.charStats().getMyRace(); if (R.bodyMask()[Race.BODY_HEAD] <= 0) { mob.tell(L("@x1 has no head!", target.name(mob))); return false; } LegalBehavior B = null; if (mob.location() != null) B = CMLib.law().getLegalBehavior(mob.location()); List<LegalWarrant> warrants = new Vector<LegalWarrant>(); if (B != null) warrants = B.getWarrantsOf(CMLib.law().getLegalObject(mob.location()), target); if ((warrants.size() == 0) && (!CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.ABOVELAW))) { mob.tell(L("You are not allowed to behead @x1 at this time.", target.Name())); return false; } final Item w = mob.fetchWieldedItem(); Weapon ww = null; if ((w == null) || (!(w instanceof Weapon))) { mob.tell(L("You cannot behead without a weapon!")); return false; } ww = (Weapon) w; if ((!auto) && (!CMSecurity.isASysOp(mob))) { if (ww.weaponDamageType() != Weapon.TYPE_SLASHING) { mob.tell(L("You cannot behead with a @x1!", ww.name())); return false; } if (mob.isInCombat() && (mob.rangeToTarget() > 0)) { mob.tell(L("You are too far away to try that!")); return false; } if (!CMLib.flags().isBoundOrHeld(target)) { mob.tell(L("@x1 is not bound and would resist.", target.charStats().HeShe())); return false; } } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; int levelDiff = target.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob))); if (levelDiff > 0) levelDiff = levelDiff * 3; else levelDiff = 0; final boolean hit = (auto) || CMLib.combat().rollToHit(mob, target); boolean success = proficiencyCheck(mob, 0, auto) && (hit); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MASK_MALICIOUS | CMMsg.MASK_MOVE | CMMsg.MASK_SOUND | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0), null); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); target.curState().setHitPoints(1); final Ability A2 = target.fetchEffect("Injury"); if (A2 != null) A2.setMiscText(mob.Name() + "/head"); CMLib.combat() .postDamage( mob, target, ww, Integer.MAX_VALUE / 2, CMMsg.MSG_WEAPONATTACK, ww.weaponClassification(), auto ? "" : L( "^F^<FIGHT^><S-NAME> rear(s) back and behead(s) <T-NAME>!^</FIGHT^>^?@x1", CMLib.protocol().msp("decap.wav", 30))); mob.location().recoverRoomStats(); final Item limb = CMClass.getItem("GenLimb"); limb.setName(L("@x1`s head", target.Name())); limb.basePhyStats().setAbility(1); limb.setDisplayText(L("the bloody head of @x1 is sitting here.", target.Name())); limb.setSecretIdentity(target.name() + "`s bloody head."); int material = RawMaterial.RESOURCE_MEAT; for (int r = 0; r < R.myResources().size(); r++) { final Item I = R.myResources().get(r); final int mat = I.material() & RawMaterial.MATERIAL_MASK; if (((mat == RawMaterial.MATERIAL_FLESH)) || (r == R.myResources().size() - 1)) { material = I.material(); break; } } limb.setMaterial(material); limb.basePhyStats().setLevel(1); limb.basePhyStats().setWeight(5); limb.recoverPhyStats(); mob.location().addItem(limb, ItemPossessor.Expire.Player_Drop); for (int i = 0; i < warrants.size(); i++) { final LegalWarrant W = warrants.get(i); W.setCrime("pardoned"); W.setOffenses(0); } } else success = false; if (mob.getVictim() == target) mob.makePeace(true); if (target.getVictim() == mob) target.makePeace(true); } else maliciousFizzle(mob, target, L("<S-NAME> attempt(s) a beheading and fail(s)!")); return success; }
protected boolean stopFalling(MOB mob) { final Room R = mob.location(); if (reversed()) { if (!hitTheCeiling) { hitTheCeiling = true; if (R != null) R.show( mob, null, CMMsg.MSG_OK_ACTION, L("<S-NAME> hit(s) the ceiling.@x1", CMLib.protocol().msp("splat.wav", 50))); CMLib.combat() .postDamage( mob, mob, this, damageToTake, CMMsg.MASK_ALWAYS | CMMsg.TYP_JUSTICE, -1, null); } return true; } hitTheCeiling = false; unInvoke(); if (R != null) { if (isAirRoom(R)) R.show( mob, null, CMMsg.MSG_OK_ACTION, L("<S-NAME> stop(s) falling.@x1", CMLib.protocol().msp("splat.wav", 50))); else if (CMLib.flags().isWaterySurfaceRoom(R) || CMLib.flags().isUnderWateryRoom(R)) R.show( mob, null, CMMsg.MSG_OK_ACTION, L("<S-NAME> hit(s) the water.@x1", CMLib.protocol().msp("splat.wav", 50))); else { R.show( mob, null, CMMsg.MSG_OK_ACTION, L("<S-NAME> hit(s) the ground.@x1", CMLib.protocol().msp("splat.wav", 50))); if (CMath.div(damageToTake, mob.maxState().getHitPoints()) > 0.05) { LimbDamage damage = (LimbDamage) mob.fetchEffect("BrokenLimbs"); if (damage == null) { damage = (LimbDamage) CMClass.getAbility("BrokenLimbs"); damage.setAffectedOne(mob); } List<String> limbs = damage.unaffectedLimbSet(); if (limbs.size() > 0) { if (mob.fetchEffect(damage.ID()) == null) { mob.addEffect(damage); damage.makeLongLasting(); } damage.damageLimb(limbs.get(CMLib.dice().roll(1, limbs.size(), -1))); } } } CMLib.combat() .postDamage( mob, mob, this, damageToTake, CMMsg.MASK_ALWAYS | CMMsg.TYP_JUSTICE, -1, null); } mob.delEffect(this); return false; }