My favorites | Sign in
Project Logo
                
Search
for
Updated Oct 08, 2008 by woefulwabbit
WritingStrategies  
Guide to writing your own strategies

Coding

Strategies are written in Java code, compiled using Janino and are then called by the simulator. Janino supports Java code up to 1.4.

Your strategy must implement the public Action getAction() method, for example:

/*
 * 1. Savage Roar at 4 Combo Points
 * 2. Rip at 5 Combo Points
 * 3. Ferocious Bite at 5 Combo Points
 *
 * This strategy was proposed by Nightcrowler
 * who found it the effective with his 
 * simulator, with full Tier 7 gear and full 
 * raid buffs. Note that this strategy is 
 * unlikely to yield good results with less 
 * than the required level of gear and buffs.
 */

int cycle = 1;
boolean finish = false;

public Action getAction() {
    // Determine if previous action was successful
    if (finish) {
        finish = false;
        if (status.getComboPoints() == 0) 
            cycle ++;
    }
    if (cycle > 3)
        cycle = 1;
        
    // Tiger's Fury whenever it has cooled down
    if (status.getFuryCooldown() == 0) {
        return Action.FURY;
    }

    switch (cycle) {
        // Savage Roar at 4
        case 1:
            if (status.getComboPoints() >= 4) {
                if (status.getEnergy() >= 25) {
                    finish = true;
                    return Action.ROAR;
                }
                else
                    return Action.NONE;
            }
            break;

        // Rip at 5
        case 2:
            if (status.getComboPoints() >= 5) {
                if (status.getEnergy() >= 30) {
                    finish = true;
                    return Action.RIP;
                }
                else
                    return Action.NONE;
            }
            break;

        // Bite at 5
        case 3:
            if (status.getComboPoints() >= 5) {
                if (status.getEnergy() >= 35) {
                    finish = true;
                    return Action.BITE;
                }
                else
                    return Action.NONE;
            }
    }

    // Get some CPs. Always keep Rake up
    if (status.getRakeTimer() == 0) {
        if ((status.getEnergy() >= status.getRakeCost()) || status.isOocUp())
            return Action.RAKE;
        else
            return Action.NONE;
    }
    // Mangle needs to be up all the time too
    if (!status.isMangleUp()) {
        if ((status.getEnergy() >= status.getMangleCost()) || status.isOocUp())
            return Action.MANGLE;
        else
            return Action.NONE;
    }
    // Then finally, shred
    if ((status.getEnergy() >= 90) || status.isOocUp()) {
        return Action.SHRED;
    }        
    return Action.NONE;
}

The getAction() method is called by the simulator every 0.1 seconds of simulated time. A status object is provided to you to query the simulator state to make your decisions. Decisions are made by returning an Action type from the method.

Variables declared inside the getAction() method do not persist between getAction() calls. If you wish to store states that persists between getAction() calls, declare the variables outside the getAction() method

Actions

These are the actions that may be returned by the getAction() method.

Action.NONE Do nothing
Action.RAKE Perform Rake
Action.MANGLE Perform Mangle
Action.SHRED Perform Shred
Action.RIP Perform Rip
Action.BITE Perform Ferocious Bite
Action.ROAR Perform Savage Roar

Status API

The status object provides the following methods to query the simulator state: Note: 1 decisecond = 0.1 seconds

int getSimTimer() Obtains the number of deciseconds since the start of the simulation
int getMangleTimer() Obtains the number of deciseconds before Mangle debuff runs out
int getRakeTimer() Obtains the number of deciseconds before Rake bleed runs out
int getRipTimer() Obtains the number of deciseconds before Rip bleed runs out
int getRoarTimer() Obtains the number of deciseconds before Savage Roar debuff runs out
int getFuryTimer() Obtains the number of deciseconds before Tiger's Fury buff runs out
int getFuryCooldown() Obtains the number of deciseconds before Tiger's Fury cooldown timer is finished
int getComboPoints() Obtains the number of Combo Points accumulated
int getEnergy() Obtains the amount of Energy stored up
boolean isOocUp() Checks if Omen of Clarity has procced
boolean isMangleUp() Checks if Mangle debuff is up on the target
boolean isBleedUp() Checks if any bleed is up on the target
int getRakeCost() Checks the energy cost of a Rake action
int getMangleCost() Checks the energy cost of a Mangle action
int getShredCost() Checks the energy cost of a Shred action



Sign in to add a comment
Hosted by Google Code