cosmetix
[k8-i-v-a-n.git] / src / game / commands / ForceVomit.cpp
blob5c8a3db11aadbaef571c93108e853c2e0c25e6d6
1 COMMAND(ForceVomit) {
2 if (Char->CanForceVomit()) {
3 int Dir = game::DirectionQuestion(CONST_S("Where do you wish to vomit? [press a direction key]"), false, true);
4 if (Dir != DIR_ERROR) {
5 v2 VomitPos = Char->GetPos()+game::GetMoveVector(Dir);
6 if (Char->GetArea()->IsValidPos(VomitPos)) {
7 ccharacter *Other = Char->GetArea()->GetSquare(VomitPos)->GetCharacter();
8 if (Other && Other->GetTeam() != Char->GetTeam() &&
9 Other->GetRelation(Char) != HOSTILE &&
10 Other->CanBeSeenBy(Char) &&
11 !game::TruthQuestion("Do you really want to vomit at "+Other->GetObjectPronoun()+"? [y/N]")) return false;
12 ADD_MESSAGE("%s", Char->GetForceVomitMessage().CStr());
13 Char->Vomit(Char->GetPos() + game::GetMoveVector(Dir), 500 + RAND() % 500, false);
14 Char->EditAP(-1000);
15 return true;
18 } else ADD_MESSAGE("You can't vomit.");
20 return false;