2 ITEM(hellsdevice
, item
) {
4 virtual truth
IsAppliable (ccharacter
*User
) const override
;
5 virtual truth
Apply (character
*User
) override
;
6 //virtual truth IsZappable (ccharacter *User) const override;
7 //virtual truth Zap (character *User, v2 curpos, int Direction) override;
10 void explode (character
*User
, v2 pos
);
16 truth
hellsdevice::IsAppliable (ccharacter
*User
) const { return true; }
17 //truth hellsdevice::IsZappable (ccharacter *User) const { return true; }
20 truth
hellsdevice::Apply (character
*User
) {
22 //if (IsBroken()) { ADD_MESSAGE("%s is totally broken.", CHAR_NAME(DEFINITE)); return false; }
24 v2 FireBallPos
= ERROR_V2
;
27 CONST_S("killed by the spells of ")+User
->GetName(INDEFINITE
),
31 ADD_MESSAGE("This could be loud...");
33 v2 Input
= game::PositionQuestion(CONST_S("Where do you wish to send the fireball? [direction keys move cursor, space accepts]"), User
->GetPos(), &game::TeleportHandler
, 0, false);
35 if (Input
== ERROR_V2
) {
37 ADD_MESSAGE("You choose not to summon a fireball... phew!");
41 lsquare
*Square
= GetNearLSquare(Input
);
44 if ((Input-User->GetPos()).GetLengthSquare() <= User->GetTeleportRangeSquare()) {
45 if (!User->IsFreeForMe(Square) || (Input == User->GetPos())) {
46 //User->EditExperience(INTELLIGENCE, 100, 1 << 10);
49 ADD_MESSAGE("The spell must target creatures, %s.", game::Insult());
50 //FireBallPos = User->GetPos(); // Better not. It's a little bit wtf for the player to understand
54 ADD_MESSAGE("You cannot concentrate yourself enough to send a fireball that far.");
55 //FireBallPos = ERROR_V2;
56 //if (User->GetNearestEnemy()) FireBallPos = User->GetNearestEnemy()->GetPos(); else
58 ADD_MESSAGE("Something very wrong happens with the spell.");
59 FireBallPos = User->GetPos();
60 Square = GetNearLSquare(User->GetPos());
69 if (FireBallPos
== ERROR_V2
) {
70 //Square = GetNearLSquare(GetLevel()->GetRandomSquare(User));
74 if (Square
->GetPos() == User
->GetPos()) ADD_MESSAGE("The scroll explodes in your face!");
76 User
->EditExperience(INTELLIGENCE
, 150, 1<<12);
77 //Square->DrawParticles(RED);
78 //!Square->FireBall(Beam);
79 //GetLevel()->Explosion(User, Beam.DeathMsg, FireBallPos, /*75+RAND()%25-RAND()%25*/400+RAND()%100);
80 explode(User
, FireBallPos
);
87 truth hellsdevice::Zap (character *User, v2 curpos, int Direction) {
88 User->EditExperience(PERCEPTION, 150, 1<<10);
92 CONST_S("killed by ")+GetName(INDEFINITE)+" zapped @bk",
98 0//GetSpecialParameters()
101 (GetLevel()->*level::GetBeam(GetBeamStyle()))(Beam);
108 void hellsdevice::explode (character
*User
, v2 pos
) {
109 festring dmsg
= CONST_S("killed by the spells of ")+User
->GetName(INDEFINITE
);
110 lsquare
*Square
= GetNearLSquare(pos
);
112 Square
->DrawParticles(RED
);
113 GetLevel()->Explosion(User
, dmsg
, pos
, /*75+RAND()%25-RAND()%25*/400+RAND()%100);
115 for (int f
= 0; f
< 8; ++f
) {
116 if (RAND()%100 > 30) {
117 v2 dest
= pos
+game::GetMoveVector(f
);
118 Square
= GetNearLSquare(dest
);
120 Square
->DrawParticles(RED
);
121 GetLevel()->Explosion(User
, dmsg
, dest
, /*75+RAND()%25-RAND()%25*/400+RAND()%100);