BuddyWing / BuddyWing.DefaultCombat

The default combat routine included with BuddyWing, the bot for SWTOR
Apache License 2.0
12 stars 12 forks source link

Spell Cooldown #12

Open cassrgs opened 8 years ago

cassrgs commented 8 years ago

Hello there

On spell.cs there is the GetCooldown() function that states the total cooldown of a spell. This function doesn't take into account alacrity modifiers. Since CanCast() suffer interference from global cooldown it would be an enormous and incredible improvement if we could have another function that states the current cooldown of a spell to use as a conditional on combat rotations as per the example bellow on a lethality operative rotation

Spell.Cast("Overload Shot", 
ret => 
Me.EnergyPercent > 85 &&
!Me.HasBuff("Tactical Advantage") && 
**CurrentCooldown**("Shiv") > 1500 &&
**CurrentCooldown**("Toxic Blast") > 1500 &&        
Me.CurrentTarget.HasDebuff("Corrosive Dart") && 
Me.CurrentTarget.HasDebuff("Corrosive Grenade") &&
!Me.IsStealthed)
,
aevitas commented 8 years ago

There are two properties in TorAbility that are possibly interesting for this: CooldownTime and GlobalCooldownTime. Both return a time in milliseconds, so you could effectively do something like:

TimeSpan actualCooldown = TimeSpan.FromMilliseconds(ability.CooldownTime - ability.GlobalCooldownTime);

Which would remove the global cooldown duration from the equation. I'm not sure how this works with modifiers, but I'd assume those are taken into account in the CooldownTime. We could add this to the TorAbility API if it actually makes sense, but that'd be purely for convenience.

I'm going to guess you're looking to use this to anticipate better on what abilities you will be using?

cassrgs commented 8 years ago

from where in the game the TorAbility gets the info, isnt there a place on the memory with the current cooldown we could get? as it appear when we enable cooldown timer text on interface?

LaoArchAngel commented 8 years ago

According to my testing, TorAbility.CooldownTime returns the "default" cooldown time of a spell, not the current cooldown. eg, if Force Lift has a cooldown of 30 seconds, it will always return 30000, whether there's 5 seconds left on the current cooldown, or even if the ability is ready and has no active cooldown.

cassrgs commented 8 years ago

Indeed, we would need a way to get the current cooldown as it appear in text when we enable it inside the game, or some kind of function inside Spell.Cast that would get the default cd with TorAbility.CooldownTime, put it in a variable and do some time -= time so that we could use the variable in the rotations

2016-07-06 18:39 GMT-03:00 Malick McGregor notifications@github.com:

According to my testing, TorAbility.CooldownTime returns the "default" cooldown time of a spell, not the current cooldown. eg, if Force Lift has a cooldown of 30 seconds, it will always return 30000, whether there's 5 seconds left on the current cooldown, or even if the ability is ready and has no active cooldown.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BosslandGmbH/BuddyWing.DefaultCombat/issues/12#issuecomment-230915567, or mute the thread https://github.com/notifications/unsubscribe/AI7YsSJphZ9f3-Yt9RzQ-Yfs69Qo3tm5ks5qTCCngaJpZM4G_vXW .

aevitas commented 8 years ago

I'll have another look at this. The game should keep track of this somewhere, but other than in the UI (which is in seconds), I wasn't able to locate it the last time.

cassrgs commented 8 years ago

any news on this? >.< that would change rotations so drasticly ;P

BobbyT1 commented 6 years ago

Anything we can do to help with this? Looking for a similiar solution for some of the internal buffs that aren't flagged by an icon now.