Class SkillAbstract

Skill is used in the battle which the player will experience boost or any kind of advantage during battle.

// example Skill which does double damage when intercept.
export class Rage extends Skill {
name = "Rage";
id = "rage";
description = "Does double damage";

use(p1: Fighter, p2: Fighter) {
p1.attack *= 2;

const embed = new MessageEmbed()
.setTitle("Skill interception")
.setColor(GREEN)
.setDescription(
oneLine`${p1.name} uses **${this.name} Skill** and increases their
strength to ${inlineCode(p1.attack)}!`
)

if (this.imageUrl)
embed.setThumbnail(this.imageUrl);

return embed;
}

// this has to be overriden to prevent from skill's side effect leak to the
// next round
close(p1: Fighter, p2: Fighter) {
p1.attack /= 2;
}
}

Hierarchy

  • Base
    • Skill

Constructors

  • Returns Skill

Properties

description: string

Skill description

id: string

The unique id of the entity. Please ensure this id does not contain any spaces

imageUrl?: string

Image to represent this skill

interceptRate: number = 0.2

Frequency of Skill being activated during battle in percentage

name: string

The name of the entity

Methods

  • Clean up or remove any attribute changes before next round

    Parameters

    Returns void

  • Returns true if skill is activated

    Returns boolean

  • Sets the skill to player

    Parameters

    Returns void

  • MessageEmbed that represents Skill

    Returns EmbedBuilder

  • Mutates fighter's attributes during battle

    Parameters

    Returns EmbedBuilder

    The embed will be shown during battle.

Generated using TypeDoc