public abstract class Skill extends java.lang.Object implements SlotContent, SaveElement, EffectSource
Constructor and Description |
---|
Skill(Character character,
java.lang.String id,
java.lang.String imgName,
EffectType type,
java.util.List<Requirement> reqs,
int castTime,
int cooldown,
java.util.List<java.lang.String> effects)
Skill constructor
|
Modifier and Type | Method and Description |
---|---|
abstract void |
activate()
Activates skill prepared skill
|
void |
draw(float x,
float y,
boolean scaledPos)
Draws skill UI icon
|
org.newdawn.slick.Sound |
getActivateSound()
Returns skill activation audio effect
|
SimpleAnim |
getActiveAnim()
Returns activation animation
|
AvatarAnimType |
getAvatarAnimType()
Returns required type of avatar animation
|
SimpleAnim |
getCastAnim()
Returns casting animation
|
org.newdawn.slick.Sound |
getCastSound()
Returns casting audio effect
|
float |
getCastTime()
Returns skill casting speed
|
int |
getCooldown()
Returns skill cooldown
|
Effect |
getEffect(java.lang.String effectId)
Return new instance of effect with specified ID from skill effects list
|
java.util.List<Effect> |
getEffects()
Returns all skill activation effects
|
java.util.List<java.lang.String> |
getEffectsIds()
Returns list with all IDs of effects from this skill
|
EffectType |
getEffectType()
Return type of skill effect
|
java.lang.String |
getId()
Returns skill ID
|
int |
getMaxStack()
Returns maximal amount of this content in one stack
|
java.lang.String |
getName()
Returns skill name
|
Character |
getOwner()
Returns skill owner
|
org.w3c.dom.Element |
getSave(org.w3c.dom.Document doc)
Parses object to XML document element
|
java.lang.String |
getSerialId()
Returns serial ID
|
Targetable |
getTarget()
Returns current skill target (may return NULL!)
|
SkillTile |
getTile()
Returns skill UI icon
|
boolean |
isActive()
Checks if skill is active
|
boolean |
isInstant() |
boolean |
isMagic()
Checks if skill is magical
|
boolean |
isReady()
Checks if skill is ready
|
abstract CharacterOut |
prepare(Character user,
Targetable target)
Prepares skill
|
void |
reset()
Resets skill to default state
|
void |
setCooldownTime(int time)
Sets specified time as current cooldown time
|
void |
setReady(boolean ready)
Sets skill ready or unready
|
void |
update(int delta)
Updates skill
|
public Skill(Character character, java.lang.String id, java.lang.String imgName, EffectType type, java.util.List<Requirement> reqs, int castTime, int cooldown, java.util.List<java.lang.String> effects)
character
- Skill ownerid
- Skill IDname
- Skill Nameinfo
- Basic informations about this skillimgName
- Skill icon imagetype
- Skill effect typemagickaCost
- Mana costcastTime
- Casting timecooldown
- Cooldown timeuseWeapon
- If weapon is needed to use this skilleffects
- Skill effect listpublic void draw(float x, float y, boolean scaledPos)
draw
in interface SlotContent
x
- Position on x-axisy
- Position on y-axisscaledPos
- If position should be scaled to resolutionpublic void update(int delta)
delta
- Time between game updatespublic void setReady(boolean ready)
ready
- True if skill should be ready, false otherwisepublic void setCooldownTime(int time)
time
- Time in millisecondspublic float getCastTime()
public int getCooldown()
public java.lang.String getId()
getId
in interface EffectSource
getId
in interface SlotContent
public java.lang.String getSerialId()
getSerialId
in interface EffectSource
getSerialId
in interface SlotContent
public int getMaxStack()
SlotContent
getMaxStack
in interface SlotContent
public java.lang.String getName()
public SkillTile getTile()
getTile
in interface SlotContent
public org.newdawn.slick.Sound getCastSound()
public org.newdawn.slick.Sound getActivateSound()
public SimpleAnim getCastAnim()
public SimpleAnim getActiveAnim()
public AvatarAnimType getAvatarAnimType()
public Targetable getTarget()
public EffectType getEffectType()
public java.util.List<Effect> getEffects()
getEffects
in interface EffectSource
public java.util.List<java.lang.String> getEffectsIds()
getEffectsIds
in interface EffectSource
public Effect getEffect(java.lang.String effectId)
getEffect
in interface EffectSource
effectId
- ID of desired effectpublic boolean isMagic()
public boolean isInstant()
public boolean isReady()
public boolean isActive()
public Character getOwner()
getOwner
in interface EffectSource
public abstract void activate()
public void reset()
public org.w3c.dom.Element getSave(org.w3c.dom.Document doc)
SaveElement
getSave
in interface SaveElement
doc
- XML document for save gamepublic abstract CharacterOut prepare(Character user, Targetable target)
user
- Character thats use skilltarget
- Character targeted by skill user