public void checkStanceStatus(Character c, Position oldStance, Position newStance) { if ((oldStance.prone(c) || !oldStance.mobile(c)) && !newStance.prone(c) && newStance.mobile(c)) { c.add(this, new Braced(c)); c.add(this, new Wary(c, 3)); } else if (!oldStance.mobile(c) && newStance.mobile(c)) { c.add(this, new Wary(c, 3)); } }
public void setStance(Position newStance) { if (Global.isDebugOn(DebugFlags.DEBUG_SCENE)) { System.out.printf( "Stance Change: %s -> %s\n", stance.getClass().getName(), newStance.getClass().getName()); } checkStanceStatus(p1, stance, newStance); checkStanceStatus(p2, stance, newStance); if (stance.inserted() && !newStance.inserted()) { List<BodyPart> parts1 = stance.partsFor(p1); List<BodyPart> parts2 = stance.partsFor(p2); parts1.forEach(part -> parts2.forEach(other -> part.onEndPenetration(this, p1, p2, other))); parts2.forEach(part -> parts1.forEach(other -> part.onEndPenetration(this, p2, p1, other))); } else if (!stance.inserted() && newStance.inserted()) { List<BodyPart> parts1 = newStance.partsFor(p1); List<BodyPart> parts2 = newStance.partsFor(p2); parts1.forEach(part -> parts2.forEach(other -> part.onStartPenetration(this, p1, p2, other))); parts2.forEach(part -> parts1.forEach(other -> part.onStartPenetration(this, p2, p1, other))); } stance = newStance; offerImage(stance.image(), ""); }