1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-08 08:23:11 +00:00

Change-Id: I3d4cd283cff0f3ea0202c4fe9b60ec5ed0b42ebd

This commit is contained in:
rogiel
2011-04-29 02:04:54 -03:00
parent 2749539f87
commit 4b9252c98f
30 changed files with 351 additions and 64 deletions

View File

@@ -0,0 +1,12 @@
package com.l2jserver.model.template;
import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.template.capability.Defendable;
import com.l2jserver.model.template.capability.IncomingDamageIntercept;
public abstract class ArmorTemplate extends ItemTemplate implements Defendable,
IncomingDamageIntercept {
public ArmorTemplate(TemplateID id) {
super(id);
}
}

View File

@@ -2,10 +2,8 @@ package com.l2jserver.model.template;
import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.template.capability.Attackable;
import com.l2jserver.model.template.capability.Enchantable;
public abstract class WeaponTemplate extends ItemTemplate implements
Attackable, Enchantable {
public abstract class WeaponTemplate extends ItemTemplate implements Attackable {
public WeaponTemplate(TemplateID id) {
super(id);
}

View File

@@ -6,5 +6,6 @@ public interface Attackable extends TemplateCapability {
void attack(Attacker source,
com.l2jserver.model.world.capability.Attackable target);
public int getDamage();
public int getPhysicalDamage();
public int getMagicalDamage();
}

View File

@@ -0,0 +1,11 @@
package com.l2jserver.model.template.capability;
import com.l2jserver.model.world.capability.Attacker;
public interface Defendable extends TemplateCapability {
void defend(Attacker source,
com.l2jserver.model.world.capability.Attackable target);
public int getPhysicalDefense();
public int getMagicalDefense();
}

View File

@@ -0,0 +1,7 @@
package com.l2jserver.model.template.capability;
import com.l2jserver.model.world.capability.Equiper;
public interface Equipable extends TemplateCapability {
void equip(Equiper equiper);
}

View File

@@ -0,0 +1,13 @@
package com.l2jserver.model.template.capability;
import com.l2jserver.model.world.capability.Damagable;
/**
* Indicates that an template has the ability to intercept incoming damage.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public interface IncomingDamageIntercept extends TemplateCapability {
void interceptIncomingDamage(Damagable target);
}

View File

@@ -0,0 +1,12 @@
package com.l2jserver.model.template.capability;
import com.l2jserver.model.world.capability.Damagable;
/**
* Indicates that an template has the ability to intercept outgoing damage.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface OutgoingDamageIntercept extends TemplateCapability {
void interceptOutgoingDamage(Damagable target);
}

View File

@@ -0,0 +1,14 @@
package com.l2jserver.model.template.capability;
import com.l2jserver.model.template.AbstractTemplate;
import com.l2jserver.model.world.capability.Equiper;
/**
* Indicated than an {@link AbstractTemplate} can add penalties to an given
* user.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Penalty extends TemplateCapability {
void penalty(Equiper user);
}

View File

@@ -2,8 +2,6 @@ package com.l2jserver.model.world;
import java.util.List;
import com.l2jserver.model.world.capability.Attackable;
import com.l2jserver.model.world.capability.Attacker;
import com.l2jserver.model.world.capability.Child;
import com.l2jserver.model.world.capability.Listenable;
import com.l2jserver.model.world.capability.Playable;
@@ -14,8 +12,7 @@ import com.l2jserver.util.Coordinate;
import com.l2jserver.util.factory.CollectionFactory;
public class Item extends AbstractObject implements Playable, Spawnable,
Attacker, Attackable, Child<Player>,
Listenable<ItemListener, ItemEvent> {
Child<Player>, Listenable<ItemListener, ItemEvent> {
private final List<ItemListener> listeners = CollectionFactory
.newList(ItemListener.class);
@@ -24,18 +21,6 @@ public class Item extends AbstractObject implements Playable, Spawnable,
}
@Override
public void receiveAttack(Attacker attacker) {
// TODO Auto-generated method stub
}
@Override
public void attack(Attackable target) {
// TODO Auto-generated method stub
}
@Override
public void addListener(ItemListener listener) {
listeners.add(listener);

View File

@@ -7,6 +7,7 @@ import com.l2jserver.model.world.capability.Attackable;
import com.l2jserver.model.world.capability.Attacker;
import com.l2jserver.model.world.capability.Castable;
import com.l2jserver.model.world.capability.Caster;
import com.l2jserver.model.world.capability.Levelable;
import com.l2jserver.model.world.capability.Listenable;
import com.l2jserver.model.world.capability.Parent;
import com.l2jserver.model.world.capability.Playable;
@@ -24,7 +25,7 @@ import com.l2jserver.util.factory.CollectionFactory;
*/
public abstract class Player extends AbstractObject implements Playable,
Spawnable, Attacker, Attackable,
Listenable<PlayerListener, PlayerEvent>, Caster, Parent {
Listenable<PlayerListener, PlayerEvent>, Caster, Parent, Levelable {
private final List<PlayerListener> listeners = CollectionFactory
.newList(PlayerListener.class);
@@ -34,14 +35,14 @@ public abstract class Player extends AbstractObject implements Playable,
}
@Override
public void receiveAttack(Attacker attacker) {
// TODO Auto-generated method stub
public void attack(Attackable target,
com.l2jserver.model.template.capability.Attackable weapon) {
}
@Override
public void attack(Attackable target) {
// TODO Auto-generated method stub
public void receiveAttack(Attacker attacker,
com.l2jserver.model.template.capability.Attackable weapon) {
}
@@ -79,4 +80,15 @@ public abstract class Player extends AbstractObject implements Playable,
// TODO Auto-generated method stub
return false;
}
@Override
public int getLevel() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setLevel(int level) {
// TODO Auto-generated method stub
}
}

View File

@@ -9,5 +9,6 @@ import com.l2jserver.model.world.AbstractObject;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Attackable extends ObjectCapability {
void receiveAttack(Attacker attacker);
void receiveAttack(Attacker attacker,
com.l2jserver.model.template.capability.Attackable weapon);
}

View File

@@ -8,5 +8,6 @@ import com.l2jserver.model.world.AbstractObject;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Attacker extends ObjectCapability {
void attack(Attackable target);
void attack(Attackable target,
com.l2jserver.model.template.capability.Attackable weapon);
}

View File

@@ -0,0 +1,16 @@
package com.l2jserver.model.world.capability;
import com.l2jserver.model.world.AbstractObject;
/**
* Defines an {@link AbstractObject} that can be damaged (HP)
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Damagable extends ObjectCapability {
void receiveDamage(int damage);
int getHP();
void setHP(int hp);
}

View File

@@ -8,7 +8,18 @@ import com.l2jserver.model.world.AbstractObject;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Enchantable extends ObjectCapability {
public int getEnchantLevel();
/**
* Get the current enchant level in the object
*
* @return the enchant level
*/
int getEnchantLevel();
public int setEnchantLevel();
/**
* Set the new enchant level in the object
*
* @param level
* the enchant level
*/
void setEnchantLevel(int level);
}

View File

@@ -10,6 +10,9 @@ import com.l2jserver.model.world.AbstractObject;
*/
public interface Equiper extends ObjectCapability {
void equip(Equipable equipable);
boolean isEquiped(Equipable equipment);
boolean isEquiped(com.l2jserver.model.template.capability.Equipable equipable);
void setEquipment(Object slot, Equipable equipment);

View File

@@ -0,0 +1,20 @@
package com.l2jserver.model.world.capability;
import com.l2jserver.model.world.AbstractObject;
import com.l2jserver.model.world.WorldObject;
/**
* Defines an {@link AbstractObject} that can be killed.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Killable extends ObjectCapability {
/**
* Process the dying routines. Note that if the object killed himself,
* <tt>killer</tt> must be his instance.
*
* @param killer
* the killer. Can be null if unknown.
*/
void die(WorldObject killer);
}

View File

@@ -0,0 +1,24 @@
package com.l2jserver.model.world.capability;
import com.l2jserver.model.world.AbstractObject;
/**
* Defines an {@link AbstractObject} that has levels.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Levelable extends ObjectCapability {
/**
* Get this object`s level
*
* @return the level
*/
int getLevel();
/**
* Set this object's level
*
* @param level
*/
void setLevel(int level);
}

View File

@@ -0,0 +1,16 @@
package com.l2jserver.model.world.capability;
import com.l2jserver.model.world.AbstractObject;
/**
* Defines an {@link AbstractObject} that can be damaged (HP)
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Mana extends ObjectCapability {
void consumeMana(int amount);
int getMP();
void setMP(int mana);
}