Arguments:

 * Object - Character or Monster

Returns:

  * Promise

Example usages:

attack(target); attack(target).then(function(data){ reduce_cooldown("attack",character.ping); // Try to increase your dps with ping correction }); attack(target).then( function(data){ game_log("yes!"); }, function(data){ game_log("oh no, attack failed: "+data.reason); }, );

Promise Reference:

"resolve"
{ source: "attack", actor: "CharacterName", target: "42", // Monster ID or Character ID damage: 1390, projectile: "momentum", eta: 50, // Arrival in milliseconds pid: "abcd1234", // Projectile ID }
"reject"
{ reason: "not_found", // Target not found }
{ reason: "too_far", // Target too far distance: 120, origin: "server", // or "client" }
{ reason: "cooldown", // Target too far remaining: 20, // 20 milliseconds remaining }
{ reason: "no_mp", // No MP }
{ reason: "disabled", // Character disabled // If you are stunned, you can't attack }
{ reason: "friendly", // PVP attacks in PVE servers // PVP attacks against friendly targets }
{ reason: "failed", // Other reasons }
{ reason: "miss", // Attack missed // Old response // Replaced by "too_far" and "cooldown" }

"source"