use of com.codingchili.realm.instance.model.npc.ListeningPerson 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));*/
}
use of com.codingchili.realm.instance.model.npc.ListeningPerson in project chili-core by codingchili.
the class SpellEngine method main.
public static void main(String[] args) {
RealmSettings settings = new RealmSettings().setName("testing");
RealmContext.create(new SystemContext(), settings).setHandler(create -> {
RealmContext rc = create.result();
InstanceContext ins = new InstanceContext(rc, new InstanceSettings());
GameContext game = new GameContext(ins);
SpellEngine engine = new SpellEngine(game);
JsonObject affConfig = ConfigurationFactory.readObject("/afflictiontest.yaml");
Affliction affliction = Serializer.unpack(affConfig, Affliction.class);
Creature target = new ListeningPerson();
Creature source = new ListeningPerson();
game.add(target);
game.add(source);
for (int i = 0; i < 500; i++) {
engine.afflict(source, target, affliction.getName());
}
});
}
Aggregations