22 package com.realtime.crossfire.jxclient.spells;
29 import org.jetbrains.annotations.NotNull;
30 import org.jetbrains.annotations.Nullable;
122 public Spell(@NotNull
final String name, @NotNull
final SkillSet skillSet, @NotNull
final Stats stats) {
231 if (this.unknown != unknown) {
250 public void setParameters(
final int faceNum,
final int tag, @NotNull
final String message,
final int level,
final int castingTime,
final int mana,
final int grace,
final int damage,
final int skill,
final int path) {
251 boolean changed =
false;
253 if (this.faceNum != faceNum) {
258 if (this.tag != tag) {
263 if (!this.message.equals(message)) {
268 if (this.level != level) {
273 if (this.castingTime != castingTime) {
278 if (this.mana != mana) {
283 if (this.grace != grace) {
288 if (this.damage != damage) {
293 if (this.skill != skill) {
298 if (this.path != path) {
322 public void updateParameters(
final boolean updateMana,
final int mana,
final boolean updateGrace,
final int grace,
final boolean updateDamage,
final int damage) {
323 boolean changed =
false;
325 if (updateMana && this.mana != mana) {
330 if (updateGrace && this.grace != grace) {
335 if (updateDamage && this.damage != damage) {
351 return "Name:"+name+
" ID:"+tag+
" Level:"+level+
" Time:"+castingTime+
" Mana:"+mana+
" Grace:"+grace+
" Damage:"+damage+
" Skill:"+skill+
" Path:"+path+
" Unknown:"+
unknown;
360 final StringBuilder sb =
new StringBuilder(
"<b>");
361 sb.append(name.substring(0, 1).toUpperCase()).append(name.substring(1));
364 sb.append(
" (unknown)");
369 sb.append(
"<br>Skill: ").append(sk);
372 sb.append(
"<br>Level: ");
373 if (sk != null && level <= sk.
getLevel()) {
375 @Nullable
final String supp;
381 supp =
" (repelled)";
385 sb.append(effective);
394 sb.append(
"<br>Mana: ").append(mana);
397 sb.append(
"<br>Grace: ").append(grace);
400 sb.append(
"<br>Damage: ").append(damage);
403 sb.append(
"<br><b>Denied</b>");
405 if (!message.isEmpty()) {
409 return sb.toString();
417 listener.spellChanged();
426 listeners.
add(listener);
434 listeners.
remove(listener);
String message
The description.
static final int CS_STAT_SPELL_ATTUNE
Attuned spell paths of a spell.
int mana
The mana needed to cast the spell.
String getName()
Returns the spell name.
int getDamage()
Returns the damage done by the spell.
int getGrace()
Returns the grace needed to cast the spell.
static final int CS_STAT_SPELL_DENY
Denied spell paths of a spell.
A list of event listeners.
final String name
The spell name.
int grace
The grace needed to cast the spell.
final Stats stats
Attuned, repelled or denied information.
int castingTime
The casting time.
static String splitAsHtml(@NotNull final String message)
Splits the given string into lines and returns the lines separated by "<br>".
int getLevel()
Returns the skill level.
int getMana()
Returns the mana needed to cast the spell.
int getSkill()
Returns the spell's skill.
int getFaceNum()
Returns the face number.
int damage
The damage done by the spell.
Spell(@NotNull final String name, @NotNull final SkillSet skillSet, @NotNull final Stats stats)
Creates a new instance.
int getCastingTime()
Returns the casting time.
String getMessage()
Returns the description.
boolean isUnknown()
Returns whether this spell is unknown to the character.
One skill of the character.
void addSpellListener(@NotNull final SpellListener listener)
Adds a SpellListener to be notified of changes.
void setParameters(final int faceNum, final int tag, @NotNull final String message, final int level, final int castingTime, final int mana, final int grace, final int damage, final int skill, final int path)
Updates the spell's parameters.
Describes a Crossfire spell.
int getTag()
Returns the tag ID.
String getTooltipText()
Returns a description for this spell to be used in tooltips.
void add(@NotNull final T listener)
Adds a listener.
int level
The spell level.
Skill getSkill(final int id)
Returns the given skill as a Skill object.
static final int CS_STAT_SPELL_REPEL
Repelled spell paths of a spell.
int getPath()
Returns the spell path.
Utility class for splitting strings.
void fireChanged()
Notifies all listeners.
int skill
The spell's skill.
void removeSpellListener(@NotNull final SpellListener listener)
Removes a SpellListener to be notified of changes.
boolean unknown
Whether this spell is unknown to the character.
This is the representation of all the statistics of a player, like its speed or its experience...
void updateParameters(final boolean updateMana, final int mana, final boolean updateGrace, final int grace, final boolean updateDamage, final int damage)
Updates the spell's parameters.
Maintain the set of skills as sent by the server.
int getLevel()
Returns the spell level.
void setUnknown(final boolean unknown)
Marks this spell as known or unknown for the character.
void remove(@NotNull final T listener)
Removes a listener.
final SkillSet skillSet
To get the skill's name, see SkillSet.
final EventListenerList2< SpellListener > listeners
The SpellListeners to be notified of changes.
int faceNum
The face number.
int getStat(final int statNo)
Returns the numerical value of the given statistic.
Interface for listeners interested in Spell related events.