View Javadoc

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  package net.sf.mud4j.effect;
17  
18  import java.io.IOException;
19  import java.util.List;
20  
21  import net.sf.mud4j.ability.CharacterAbility;
22  import net.sf.mud4j.character.Character;
23  import net.sf.mud4j.damage.DamageBehavior;
24  import net.sf.mud4j.world.item.Item;
25  
26  /**
27   * Provide effects as a decorator to a character.
28   * 
29   * @author Matthew Purland
30   */
31  public abstract class CharacterEffectDecorator implements Character, Effectable {
32  
33      // Character to decorate
34      private Character character;
35      
36      public CharacterEffectDecorator(Character character) {
37          this.character = character;
38      }
39      
40      /**
41       * {@inheritDoc}
42       */
43      public List<CharacterAbility> getAbilities() {
44          return character.getAbilities();
45      }
46  
47      /**
48       * {@inheritDoc}
49       */
50      public List<Item> getItems() {
51          return character.getItems();
52      }
53  
54      /**
55       * {@inheritDoc}
56       */
57      public int getLevel() {
58          return character.getLevel();
59      }
60  
61      /**
62       * {@inheritDoc}
63       */
64      public String getName() {
65          return character.getName();
66      }
67  
68      /**
69       * {@inheritDoc}
70       */
71      public boolean hasAbility(CharacterAbility ability) {
72          return character.hasAbility(ability);
73      }
74  
75      /**
76       * {@inheritDoc}
77       */
78      public boolean hasItem(Item item) {
79          return character.hasItem(item);
80      }
81  
82      /**
83       * {@inheritDoc}
84       */
85      public DamageBehavior getDamageBehavior() {
86          return character.getDamageBehavior();
87      }
88  
89      /**
90       * {@inheritDoc}
91       */
92      public void setDamageBehavior(DamageBehavior damageBehavior) {
93          character.setDamageBehavior(damageBehavior);
94      }
95  
96      /**
97       * {@inheritDoc}
98       */
99      public void message(String message) throws IOException {
100         character.message(message);
101     }
102 
103 }