-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathability_paid_tank_heavy_sensor_armstrong_ability.sp
179 lines (139 loc) · 4.8 KB
/
ability_paid_tank_heavy_sensor_armstrong_ability.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#pragma semicolon 1
#include <sourcemod>
#include <tf2_stocks>
#include <tf2attributes>
#include <berobot_constants>
#include <berobot>
#include <tf_custom_attributes>
#include <tf_ontakedamage>
#define PLUGIN_VERSION "1.0"
#define ROBOT_NAME "Sensor Armstrong"
bool g_Nanomode = false;
float g_DamageDone = 0.0;
public Plugin:myinfo =
{
name = "[TF2] Sensor Armstrong Ability",
author = "HiGPS | Bmod.TF",
description = "The Ability for Sensor Armstrong Robot",
version = PLUGIN_VERSION,
url = "www.sourcemod.com"
}
public Action TF2_OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom, CritType &critType)
{
// if (!g_Enable)
// return Plugin_Continue;
if(!IsValidClient(victim))
return Plugin_Continue;
// if(!IsValidClient(attacker))
// return Plugin_Continue;
if (IsRobot(attacker, ROBOT_NAME) || IsRobot(victim, ROBOT_NAME))
{
if (IsRobot(victim, ROBOT_NAME))
{
if (TF2_IsPlayerInCondition(victim, TFCond_Ubercharged) || (TF2_IsPlayerInCondition(victim, TFCond_UberchargedCanteen)))
{
return Plugin_Continue;
}
}
if (IsRobot(attacker, ROBOT_NAME))
{
if (TF2_IsPlayerInCondition(victim, TFCond_Ubercharged) || (TF2_IsPlayerInCondition(victim, TFCond_UberchargedCanteen)
|| TF2_IsPlayerInCondition(attacker, TFCond_Ubercharged) || TF2_IsPlayerInCondition(attacker, TFCond_UberchargedCanteen) ))
{
return Plugin_Continue;
}
}
g_DamageDone += damage;
}
return Plugin_Continue;
}
bool g_button_held[MAXPLAYERS + 1] = {false, ...};
float g_duration = 5.0;
float FireModeTimer = -1.0;
float g_skill;
float g_skill_cooldown = 2500.0;
// float g_skill_time;
public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3], float angles[3], int& weapon, int& subtype, int& cmdnum, int& tickcount, int& seed, int mouse[2])
{
if (IsRobot(client, ROBOT_NAME))
{
//0 = fireball
//PrintToChat(client, "Throwing spell!");
if( GetEntProp( client, Prop_Data, "m_afButtonPressed" ) & (IN_ATTACK3|IN_USE) )
{
// PrintToChatAll("Press");
g_button_held[client] = true;
}
if( GetEntProp( client, Prop_Data, "m_afButtonReleased" ) & (IN_ATTACK3|IN_USE) )
{
// PrintToChatAll("Release");
g_button_held[client] = false;
}
g_skill = GetEngineTime();
DrawHUD(client);
}
return Plugin_Continue;
}
#define CHAR_FULL "■"
#define CHAR_EMPTY "□"
void DrawHUD(int client)
{
char sHUDText[128];
char sProgress[32];
int iPercents = RoundToCeil(g_DamageDone / g_skill_cooldown * 100.0);
for (int j = 1; j <= 10; j++)
{
if (iPercents >= j * 10)StrCat(sProgress, sizeof(sProgress), CHAR_FULL);
else StrCat(sProgress, sizeof(sProgress), CHAR_EMPTY);
}
//PrintToChatAll("Damage: %f, skilltime %f", g_DamageDone, g_skill_cooldown);
// int iCountDown = RoundToCeil(g_skill_time - g_skill);
int iCountDownFiring = RoundToCeil(FireModeTimer - g_skill);
Format(sHUDText, sizeof(sHUDText), "Nanomachines: %i %%%%\n %s",iPercents, sProgress);
if(iPercents >= 100)
{
if (g_Nanomode){
Format(sHUDText, sizeof(sHUDText), "Nanomachines! %i", iCountDownFiring);
SetHudTextParams(0.85, 0.6, 0.1, 255, 255, 0, 255);
}else{
Format(sHUDText, sizeof(sHUDText), "Nanomachines Ready!\nUse Special Attack to Activate!");
SetHudTextParams(0.85, 0.6, 0.1, 0, 255, 0, 255);
}
}else {
SetHudTextParams(0.85, 0.6, 0.1, 255, 255, 255, 255);
}
if (g_button_held[client] && iPercents >= 100 && !g_Nanomode)
{
if (FireModeTimer <= GetEngineTime() || FireModeTimer == -1.0)
{
TF2_AddCondition(client, TFCond_UberchargedCanteen, g_duration);
TF2_AddCondition(client, TFCond_HalloweenQuickHeal, g_duration);
TF2Attrib_AddCustomPlayerAttribute(client, "healing received bonus", 4.0, g_duration);
TF2Attrib_AddCustomPlayerAttribute(client, "mod weapon blocks healing", 1.0, g_duration);
TF2Attrib_AddCustomPlayerAttribute(client, "move speed penalty", 0.9);
g_DamageDone = 0.0;
}
}
if (FireModeTimer <= GetEngineTime() && g_Nanomode)
{
g_Nanomode = false;
g_DamageDone = 0.0;
}
ShowHudText(client, -3, sHUDText);
// b_hud_clamp[client] = false;
}
public void TF2_OnConditionRemoved(int client, TFCond condition)
{
//PrintToChatAll("CONDITION REMOVED!");
if (IsRobot(client, ROBOT_NAME)){
if(condition == TFCond_UberchargedCanteen){
TF2Attrib_RemoveCustomPlayerAttribute(client, "move speed penalty");
TF2_AddCondition(client, TFCond_SpeedBuffAlly, 0.1);
TF2Attrib_SetByName(client, "move speed penalty", 1.2);
TF2_AddCondition(client, TFCond_SpeedBuffAlly, 0.1);
}
// TF2_RemoveCondition(client, TFCond_Dazed);
// TF2_RemoveCondition(client, TFCond_KnockedIntoAir);
// PrintToChatAll("Condition was: %i", condition);
}
}