@@ -57,7 +57,6 @@ char SpellCastingSounds[SPELL_CAST_SOUNDS_NUM][] = {
5757" misc/halloween/merasmus_stun.wav"
5858}
5959
60- #define SND_GOOFY_SPELL " "
6160
6261// Note that non-wizard heavies can also use BAD Wizard's voice lines, and a Wizard can use GOOD non-Wizard's voice lines
6362#define SPELL_VO_SHARED 1 // To disable it set this value to 0
@@ -134,6 +133,8 @@ SPELL_SWIMMING,
134133SPELL_JUMPING ,
135134SPELL_SPEEDUP ,
136135SPELL_INSTANTDEATH ,
136+ SPELL_REPLACE ,
137+ SPELL_SCRAMBLE ,
137138NUM_SPELLS
138139}
139140int SpellFlags []=
@@ -155,7 +156,9 @@ int SpellFlags[]=
155156(SPELLFLAG_FUN | SPELLFLAG_MAY_ON_ALLY | SPELLFLAG_MAY_ON_FOE | SPELLFLAG_ON_YOURSELF | SPELLFLAG_IN_EVERYWHERE ),
156157(SPELLFLAG_FUN | SPELLFLAG_MAY_ON_EVERYONE | SPELLFLAG_MAY_ON_ALLY | SPELLFLAG_MAY_ON_FOE | SPELLFLAG_IN_EVERYWHERE ),
157158(SPELLFLAG_BUFF | SPELLFLAG_ON_ALLY | SPELLFLAG_IN_RANGE ),
158- (SPELLFLAG_HARM | SPELLFLAG_ON_FOE | SPELLFLAG_IN_RANGE | SPELLFLAG_MAY_ON_YOURSELF )
159+ (SPELLFLAG_HARM | SPELLFLAG_ON_FOE | SPELLFLAG_IN_RANGE | SPELLFLAG_MAY_ON_YOURSELF ),
160+ (SPELLFLAG_BUFF | SPELLFLAG_ON_YOURSELF ),
161+ (SPELLFLAG_FUN | SPELLFLAG_ON_YOURSELF ) // Casting this on yourself will cause everyone to switch places
159162}
160163int CurrentHoovyWizard
161164int CurrentSpellFlags
@@ -165,7 +168,7 @@ typeset SpellCallback
165168{
166169 function void (int client )
167170}
168- SpellCallback SpellList [18 ]
171+ SpellCallback SpellList [20 ]
169172#define getSpellCb SpellCallback cb = SpellList [CurrentSpell ]
170173#define IsAllowedToCast(% 1 ) (((CurrentSpellFlags & SPELLFLAG_ON_YOURSELF )&& (CurrentHoovyWizard ==% 1 ))|| ((CurrentSpellFlags & SPELLFLAG_ON_ALLY )&& TF2_GetClientTeam (% 1 )== CurrentWizardTeam )|| ((CurrentSpellFlags & SPELLFLAG_ON_FOE )&& TF2_GetClientTeam (% 1 )!= CurrentWizardTeam ))
171174bool HoovySpellTraceFilter (int entity )
@@ -202,12 +205,37 @@ public Spells_OnPluginStart()
202205 cb (SPELL_JUMPING ,SpellJumping )
203206 cb (SPELL_SPEEDUP ,SpellSpeedup )
204207 cb (SPELL_INSTANTDEATH ,SpellInstantDeath )
208+ cb (SPELL_REPLACE ,SpellReplace )
209+ cb (SPELL_SCRAMBLE ,SpellScramble )
205210 #undef cb
206211 for (int i = 0 ;i < SPELL_VO_GOOD_WIZARD_NUM ;i ++ )PrecacheSound (SpellCommentGood_Wizard [i ])
207212 for (int i = 0 ;i < SPELL_VO_GOOD_NUM ;i ++ )PrecacheSound (SpellCommentGood [i ])
208213 for (int i = 0 ;i < SPELL_VO_BAD_NUM ;i ++ )PrecacheSound (SpellCommentBad [i ])
209214 for (int i = 0 ;i < SPELL_VO_BAD_WIZARD_NUM ;i ++ )PrecacheSound (SpellCommentBad_Wizard [i ])
210215 for (int i = 0 ;i < SPELL_CAST_SOUNDS_NUM ;i ++ )PrecacheSound (SpellCastingSounds [i ])
216+ RegAdminCmd (" hassault_test_spell" ,TestSpellCommand ,ADMFLAG_RCON )
217+ }
218+ public Action TestSpellCommand (client , args )
219+ {
220+ if (! ValidUser (client ))return Plugin_Handled
221+ if (args < 1 )
222+ {
223+ PrintToConsole (client ," You must specify spell to cast" )
224+ return Plugin_Handled
225+ }
226+ int spellid = GetCmdArgInt (1 )
227+ if (spellid >= NUM_SPELLS )
228+ {
229+ PrintToConsole (client ," There\' s no spell like this in your spellbook" )
230+ return Plugin_Handled
231+ }
232+ CurrentWizardTeam = TF2_GetClientTeam (client )
233+ int team = CurrentWizardTeam == TFTeam_Blue ? 1 : 0
234+ int buf = SpellIds [0 ][team ]
235+ SpellIds [0 ][team ] = spellid
236+ TryCastingSpell (client ,0 )
237+ SpellIds [0 ][team ] = buf
238+ return Plugin_Handled
211239}
212240float SpellMapBoundsMin [3 ],SpellMapBoundsMax [3 ]
213241public Spells_OnMapStart ()
@@ -469,6 +497,52 @@ void SpellInstantDeath(int client)
469497{
470498 SetEntityHealth (client ,1 )
471499}
500+ void SpellReplace (int client )
501+ {
502+ ArrayList clist = CreateArray ()
503+ for (int i = 1 ;i < MaxClients ;i ++ )
504+ {
505+ if (! ValidUser (i )|| i == client || GetClientTeam (i )== GetClientTeam (client ))continue ;
506+ clist .Push (i )
507+ }
508+ if (clist .Length > 0 )
509+ {
510+ int index = clist .Get (GetRandomInt (0 ,clist .Length - 1 ))
511+ FakeClientCommandEx (client ," dropitem" )
512+ FakeClientCommandEx (index ," dropitem" )
513+ TeleportEntity (client ,HoovyCoords [index ],NULL_VECTOR ,NULL_VECTOR )
514+ TeleportEntity (index ,HoovyCoords [client ],NULL_VECTOR ,NULL_VECTOR )
515+ }
516+ clist .Clear ()
517+ delete clist
518+ }
519+ void SpellScramble (int client )
520+ {
521+ ArrayList clist = CreateArray ()
522+ for (int i = 1 ;i < MaxClients ;i ++ )
523+ {
524+ if (! ValidUser (i ))continue ;
525+ clist .Push (i )
526+ }
527+ if (clist .Length > 0 )
528+ {
529+ while (clist .Length >= 2 )
530+ {
531+ int index = GetRandomInt (0 ,clist .Length - 1 )
532+ int cl1 = clist .Get (index )
533+ RemoveFromArray (clist ,index )
534+ index = GetRandomInt (0 ,clist .Length - 1 )
535+ int cl2 = clist .Get (index )
536+ RemoveFromArray (clist ,index )
537+ FakeClientCommandEx (cl1 ," dropitem" )
538+ FakeClientCommandEx (cl2 ," dropitem" )
539+ TeleportEntity (cl2 ,HoovyCoords [cl1 ],NULL_VECTOR ,NULL_VECTOR )
540+ TeleportEntity (cl1 ,HoovyCoords [cl2 ],NULL_VECTOR ,NULL_VECTOR )
541+ }
542+ }
543+ clist .Clear ()
544+ delete clist
545+ }
472546public Action JumpTimer (Handle timer ,i )
473547{
474548 if (ValidUser (i )&& (SpellJumpingCurse [i ]> 0 ))
0 commit comments