-
Notifications
You must be signed in to change notification settings - Fork 30
Samyro #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mikusch
wants to merge
11
commits into
master
Choose a base branch
from
samyro
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Samyro #192
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1a81264
Add Samyro
Mikusch 7a3add4
c before d
Mikusch 634895f
Better description
Mikusch 511e0c4
Add super rage support in CRageAddCond
Mikusch 2ca70fc
Move command listener to console.sp
Mikusch 8c44e96
I am learning the alphabet
Mikusch 3f878ba
Prevent using ability during rage
Mikusch f6f826f
Refund remaining condition duration on removal
Mikusch ee7cff5
Merge branch 'master' into samyro
FortyTwoFortyTwo e3a8f33
i broke somewhere
FortyTwoFortyTwo f6bb17a
will this ever be finished
FortyTwoFortyTwo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
addons/sourcemod/scripting/vsh/abilities/ability_conditions.sp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| static ArrayList g_aConditions[TF_MAXPLAYERS + 1]; | ||
|
|
||
| public void AddCond_Create(SaxtonHaleBase boss) | ||
| { | ||
| if (g_aConditions[boss.iClient] == null) | ||
| g_aConditions[boss.iClient] = new ArrayList(); | ||
| g_aConditions[boss.iClient].Clear(); | ||
|
|
||
| boss.SetPropFloat("AddCond", "CondDuration", 30.0); | ||
| boss.SetPropFloat("AddCond", "CondCooldownWait", 0.0); | ||
| boss.SetPropFloat("AddCond", "CondDuration", 8.0); | ||
| boss.SetPropFloat("AddCond", "CondMaxCharge", 1.0); | ||
| } | ||
|
|
||
| public void AddCond_AddCond(SaxtonHaleBase boss, TFCond cond) | ||
| { | ||
| g_aConditions[boss.iClient].Push(cond); | ||
| } | ||
|
|
||
| public void AddCond_GetHudInfo(SaxtonHaleBase boss, char[] sMessage, int iLength, int iColor[4]) | ||
| { | ||
| int iCharge; | ||
|
|
||
| float flCondCooldownWait = boss.GetPropFloat("AddCond", "CondCooldownWait"); | ||
| if (flCondCooldownWait < GetGameTime()) | ||
| { | ||
| iCharge = RoundToFloor(boss.GetPropFloat("AddCond", "CondMaxCharge") * 100.0); | ||
| } | ||
| else | ||
| { | ||
| float flPercentage = (flCondCooldownWait - GetGameTime()) / boss.GetPropFloat("AddCond", "CondCooldown"); | ||
| iCharge = RoundToFloor((boss.GetPropFloat("AddCond", "CondMaxCharge") - flPercentage) * 100.0); | ||
| } | ||
|
|
||
| if (iCharge >= 100) | ||
| Format(sMessage, iLength, "Ability Charge: %d%%%% - Press MOUSE2 to use!", iCharge); | ||
| else | ||
| Format(sMessage, iLength, "Ability Charge: %d%%%%", iCharge); | ||
| } | ||
|
|
||
| public void AddCond_OnButtonPress(SaxtonHaleBase boss, int iButton) | ||
| { | ||
| if (iButton == IN_ATTACK2 && GameRules_GetRoundState() != RoundState_Preround && !TF2_IsPlayerInCondition(boss.iClient, TFCond_Dazed)) | ||
| { | ||
| float flCondCooldownWait = boss.GetPropFloat("AddCond", "CondCooldownWait"); | ||
| if (flCondCooldownWait < GetGameTime()) | ||
| { | ||
| flCondCooldownWait = GetGameTime(); | ||
| boss.SetPropFloat("AddCond", "CondCooldownWait", flCondCooldownWait); | ||
| } | ||
|
|
||
| float flPercentage = (flCondCooldownWait - GetGameTime()) / boss.GetPropFloat("AddCond", "CondCooldown"); | ||
| float flCharge = boss.GetPropFloat("AddCond", "CondMaxCharge") - flPercentage; | ||
|
|
||
| if (flCharge < 1.0) | ||
| return; | ||
|
|
||
| for (int i = 0; i < g_aConditions[boss.iClient].Length; i++) | ||
| { | ||
| TF2_AddCondition(boss.iClient, g_aConditions[boss.iClient].Get(i), boss.GetPropFloat("AddCond", "CondDuration")); | ||
| } | ||
|
|
||
| flCondCooldownWait += boss.GetPropFloat("AddCond", "CondCooldown"); | ||
| boss.SetPropFloat("AddCond", "CondCooldownWait", flCondCooldownWait); | ||
|
|
||
| char sSound[PLATFORM_MAX_PATH]; | ||
| boss.CallFunction("GetSoundAbility", sSound, sizeof(sSound), "AddCond"); | ||
| if (!StrEmpty(sSound)) | ||
| EmitSoundToAll(sSound, boss.iClient, SNDCHAN_VOICE, SNDLEVEL_SCREAMING); | ||
| } | ||
| } | ||
|
|
||
| public void AddCond_OnRage(SaxtonHaleBase boss) | ||
| { | ||
| if (boss.GetPropInt("AddCond", "RemoveOnRage")) | ||
| { | ||
| for (int i = 0; i < g_aConditions[boss.iClient].Length; i++) | ||
| { | ||
| TF2_RemoveCondition(boss.iClient, g_aConditions[boss.iClient].Get(i)); | ||
| } | ||
|
|
||
| //If conditions are removed due to rage, refund remaining duration as cooldown reduction | ||
| float flCondCooldownWait = boss.GetPropFloat("AddCond", "CondCooldownWait"); | ||
| float flDurationRemaining = flCondCooldownWait - GetGameTime() - boss.GetPropFloat("AddCond", "CondCooldown") + boss.GetPropFloat("AddCond", "CondDuration"); | ||
| if (0 < flDurationRemaining < boss.GetPropFloat("AddCond", "CondDuration")) | ||
| boss.SetPropFloat("AddCond", "CondCooldownWait", flCondCooldownWait - flDurationRemaining); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.