Merging 1.7.5 Source: actors/buffs changes
This commit is contained in:
@@ -56,19 +56,29 @@ public class Buff extends Actor {
|
||||
public int icon() {
|
||||
return BuffIndicator.NONE;
|
||||
}
|
||||
|
||||
|
||||
public static<T extends Buff> T append( Char target, Class<T> buffClass ) {
|
||||
try {
|
||||
T buff = buffClass.newInstance();
|
||||
buff.attachTo( target );
|
||||
return buff;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static<T extends FlavourBuff> T append( Char target, Class<T> buffClass, float duration ) {
|
||||
T buff = append( target, buffClass );
|
||||
buff.spend( duration );
|
||||
return buff;
|
||||
}
|
||||
|
||||
public static<T extends Buff> T affect( Char target, Class<T> buffClass ) {
|
||||
T buff = target.buff( buffClass );
|
||||
if (buff != null) {
|
||||
return buff;
|
||||
} else {
|
||||
try {
|
||||
buff = buffClass.newInstance();
|
||||
buff.attachTo( target );
|
||||
return buff;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return append( target, buffClass );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user