public boolean tick(Queue q) { ticks--; boolean continuing = ticks > 0; if (!continuing) { bearer.getRoom().notice(bearer, bearer.getName() + "s ball of darkness dissappears."); bearer.notice("Your ball of darkness dissappears."); } return continuing; }
public void onWield(Living who) { if (modifiers == null) return; Enumeration en = modifiers.elements(); while (en.hasMoreElements()) { DefaultModifierImpl m = (DefaultModifierImpl) en.nextElement(); m.setActive(true); who.addModifier(m); } }
public void run(Living who, Vector params) { if (params.size() < 2) { who.notice("Usage: lock <direction>"); } else { String dir = params.get(1).toString(); Exit exit = (Exit) who.getRoom().findByNameAndType(dir, Types.EXIT); if (exit instanceof LockableDoor) { LockableDoor ld = (LockableDoor) exit; if (ld.isLocked()) { who.notice("It is already locked."); return; } boolean haveKeys = false; boolean properKey = false; Iterator items = who.findByType(Types.ITEM); while (items.hasNext()) { Item item = (Item) items.next(); if (item instanceof Key) { haveKeys = true; Key key = (Key) item; if (key.getKeyCode().equals(ld.getKeyCode())) { properKey = true; ld.setLocked(true); who.notice("You lock the door with " + key.getDescription() + "."); break; } } } if (!haveKeys) { who.notice("You don't have any keys."); } else if (!properKey) { who.notice("You don't have the right key."); } } else { who.notice("Lock what?"); } } return; }
public void use(SkillUsageContext suc) { Living who = suc.getActor(); MObject target = suc.getTarget(); int success = suc.getSkillSuccess(); if (success > 0) { who.notice("You chant 'Noir Noir' and create a ball of darkness."); who.getRoom() .notice(who, who.getName() + " chants 'Noir Noir' and creates a ball of darkness."); who.addModifier(new DarknessModifier(20, who)); } else { who.notice("You chant 'Noir Noir' but your spell just fizzles."); who.getRoom().notice(who, who.getName() + " chants 'Noir Noir'."); } }