1 /**
2 * Copyright 2006 Matthew Purland (m.purland@gmail.com)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package net.sf.mud4j.character;
18
19 import java.io.IOException;
20 import java.util.List;
21
22 import net.sf.mud4j.ability.CharacterAbility;
23 import net.sf.mud4j.damage.DamageBehavior;
24 import net.sf.mud4j.effect.EffectBehavior;
25 import net.sf.mud4j.world.item.Item;
26
27 /**
28 * Abstract character implementation for character implementations
29 * to implement for default functions.
30 *
31 * Provides IoC mechanism to populate character information.
32 *
33 * @author Matthew Purland
34 */
35 public
36
37
38 private String characterName;
39
40
41 private int characterLevel;
42
43
44 private List<CharacterAbility> characterAbilities;
45
46
47 private List<Item> characterItems;
48
49
50 private DamageBehavior damageBehavior;
51
52
53 private EffectBehavior effectBehavior;
54
55 public AbstractCharacter() {
56
57 }
58
59 public AbstractCharacter(String characterName) {
60 this();
61 this.characterName = characterName;
62 }
63
64 /**
65 * {@inheritDoc}
66 */
67 public List<CharacterAbility> getAbilities() {
68 return characterAbilities;
69 }
70
71 /**
72 * {@inheritDoc}
73 */
74 public List<Item> getItems() {
75 return characterItems;
76 }
77
78 /**
79 * {@inheritDoc}
80 */
81 public boolean hasItem(Item item) {
82 return characterItems.contains(item);
83 }
84
85 /**
86 * {@inheritDoc}
87 */
88 public String getName() {
89 return characterName;
90 }
91
92 /**
93 * {@inheritDoc}
94 */
95 public boolean hasAbility(CharacterAbility ability) {
96 return characterAbilities.contains(ability);
97 }
98
99 /**
100 * {@inheritDoc}
101 */
102 public
103
104 }
105
106 /**
107 * {@inheritDoc}
108 */
109 public int getLevel() {
110 return characterLevel;
111 }
112
113 /**
114 * {@inheritDoc}
115 */
116 public EffectBehavior getEffectBehavior() {
117 return effectBehavior;
118 }
119
120 /**
121 * {@inheritDoc}
122 */
123 public void setEffectBehavior(EffectBehavior effectBehavior) {
124 this.effectBehavior = effectBehavior;
125 }
126
127 /**
128 * {@inheritDoc}
129 */
130 public DamageBehavior getDamageBehavior() {
131 return damageBehavior;
132 }
133
134 /**
135 * {@inheritDoc}
136 */
137 public void setDamageBehavior(DamageBehavior damageBehavior) {
138 this.damageBehavior = damageBehavior;
139
140 }
141
142 }