use of com.codingchili.realm.instance.model.spells.SpellTarget in project chili-core by codingchili.
the class GameContext method main.
public static void main(String[] args) throws InterruptedException {
RealmSettings settings = new RealmSettings().setName("testing");
RealmContext.create(new SystemContext(), settings).setHandler(create -> {
RealmContext realm = create.result();
InstanceContext ins = new InstanceContext(realm, new InstanceSettings());
GameContext game = new GameContext(ins);
/* game.ticker(ticker -> {
System.out.println("DING");
}, 50);*/
Creature cl = new ListeningPerson();
game.add(cl);
// cast the poison spell on himself.
cl.getSpells().getLearned().add("poisoner");
for (int i = 0; i < 2; i++) {
boolean casted = game.spells.cast(cl, new SpellTarget().setCreature(cl), "poisoner");
System.out.println("casted = " + casted);
}
});
// todo: add more hooks to SpellEngine afflictions. onDamage etc.
// todo: test cases
// todo: script npcs: onDeath, onAI etc.
// - afflict, duration, cancel etc.
// - cast spell: cooldown, charges etc.
/*for (int i = 0; i < 200; i++) {
game.add(new TalkingPerson());
game.add(new TalkingPerson());
game.add(new ListeningPerson());
}*/
/*game.ticker(ticker -> {
System.out.println(ListeningPerson.called);
}, TICK_INTERVAL_MS);*/
// game.ticker((ticker) -> System.out.println(ticker.delta()), 1);
// System.exit(0);
/* game.addCreature(new TalkingPerson(game));
game.addCreature(new TalkingPerson(game));
game.addCreature(new ListeningPerson(game));*/
}
Aggregations