void moveAction(Vec2 dir) override { if (!isGhost) { Player::moveAction(dir); return; } if (Creature *c = creature->getSquare(dir)->getCreature()) { if (c == owner) owner->popController(); else c->pushController(PController(new PossessedController(c, owner, model, levelMemory, false))); creature->die(); } else Player::moveAction(dir); }
Controller* Player::getPossessedController(Creature* c) { creature->pushController(PController(new DoNothingController(creature))); return new PossessedController(c, creature, model, levelMemory, true); }
PController ControllerFactory::get(Creature* c) { return PController(fun(c)); }