Bug - Fixed Timers are unshrugable

Erich

Member
If I have an in game timer set (/timer 4 test), and I try to click the turns left to shrug it, I get this error msg in the gcli:

Code:
> uneffect Timer 1

Timer 1 is unremovable.

... however, I can right click shrug it, or /shrug it as well.

(using r11709)
 
Actually, I am incorrect here. The offending logic in UneffectRequest.java:

Code:
public static final boolean isRemovable( final int effectId )
	{
		// http://forums.kingdomofloathing.com/vb/showthread.php?t=195401
		// 
		// The following effects should now no longer be removable by any means:
		// Goofball Withdrawal
		// Soul-Crushing Headache
		// Coated in Slime
		// Everything Looks Yellow
		// Everything Looks Blue
		// Everything Looks Red
		// Timer effects

		switch ( effectId )
		{
		case -1:
			// So, what about the following?
		case EffectPool.EAU_DE_TORTUE_ID:
		case EffectPool.CURSED_BY_RNG_ID:
		case EffectPool.FORM_OF_BIRD_ID:

		case EffectPool.GOOFBALL_WITHDRAWAL_ID:
		case EffectPool.SOUL_CRUSHING_HEADACHE_ID:
		case EffectPool.COVERED_IN_SLIME_ID:
		case EffectPool.EVERYTHING_LOOKS_YELLOW_ID:
		case EffectPool.EVERYTHING_LOOKS_BLUE_ID:
		case EffectPool.EVERYTHING_LOOKS_RED_ID:
		case EffectPool.TIMER1_ID:
		case EffectPool.TIMER2_ID:
		case EffectPool.TIMER3_ID:
		case EffectPool.TIMER4_ID:
		case EffectPool.TIMER5_ID:
		case EffectPool.TIMER6_ID:
		case EffectPool.TIMER7_ID:
		case EffectPool.TIMER8_ID:
		case EffectPool.TIMER9_ID:
		case EffectPool.TIMER10_ID:
			return false;
		default:
			return true;
		}
	}
Even though the timer effects are shruggable, the logic here overrides that. To fix, change line 538 from:
Code:
if ( !UneffectRequest.isRemovable( this.effectId ) )
to:
Code:
if ( !UneffectRequest.isRemovable( this.effectId ) || !UneffectRequest.isShruggable( this.effect.getName() ) )
 

Veracity

Developer
Staff member
Or, you know, maybe something else. Like simply removing the case labels for timers from isRemovable.
 
That would work too... BUT that change would have unwanted side effects. Timers can be shrugged, but cannot be SGEEA'd away.
 

Veracity

Developer
Staff member
So explain how the side effect would be visible. Tell me exactly how & when KoLmafia would try to SGEEA away a timer.
Thanks.
 
You are correct, at least as far as I can tell.

I have not analyzed the effect removing logic enough to know which analysis is correct - but I can safely assume Veracity knows the code better than I do. ;)
 

roippi

Developer
Code:
public UneffectRequest( final AdventureResult effect )
	{
		super( UneffectRequest.isShruggable( effect.getName() ) ? "charsheet.php" : "uneffect.php" );

		this.effect = effect;
		String name = effect.getName();
		this.effectId = EffectDatabase.getEffectId( name );
[B]		this.isShruggable = UneffectRequest.isShruggable( name );[/B]
		this.isTimer = name.startsWith( "Timer " );

		if ( this.isShruggable )
		{
[B]			this.addFormField( "action", "unbuff" );[/B]
			this.addFormField( "ajax", "1" );
			this.addFormField( "whichbuff", String.valueOf( this.effectId ) );
		}

Code:
	public static final boolean isShruggable( final String effectName )
	{
[B]		if ( effectName.startsWith( "Timer " ) )[/B]
		{
			return true;
		}

r11721
 

Catch-22

Active member
Code:
	public static final boolean isShruggable( final String effectName )
	{
[B]		if ( effectName.startsWith( "Timer " ) )[/B]
		{
			return true;
		}

in b4 TBTB introduce an effect that begins with "Timer " that isn't actually a timer.
 
Top