Search in sources :

Example 1 with SystemContext

use of com.codingchili.core.context.SystemContext in project chili-core by codingchili.

the class HashHelperTest method setUp.

@Before
public void setUp() {
    context = new SystemContext();
    hasher = new HashHelper(new SystemContext());
    executor = context.vertx().createSharedWorkerExecutor("worker_pool_name", 8);
}
Also used : SystemContext(com.codingchili.core.context.SystemContext) Before(org.junit.Before)

Example 2 with SystemContext

use of com.codingchili.core.context.SystemContext in project chili-core by codingchili.

the class LauncherIT method setUp.

@Before
public void setUp() {
    core = new SystemContext();
    Delay.initialize(core);
}
Also used : SystemContext(com.codingchili.core.context.SystemContext) Before(org.junit.Before)

Example 3 with SystemContext

use of com.codingchili.core.context.SystemContext 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));*/
}
Also used : RealmSettings(com.codingchili.realm.configuration.RealmSettings) SpellTarget(com.codingchili.realm.instance.model.spells.SpellTarget) RealmContext(com.codingchili.realm.configuration.RealmContext) SystemContext(com.codingchili.core.context.SystemContext) ListeningPerson(com.codingchili.realm.instance.model.npc.ListeningPerson)

Example 4 with SystemContext

use of com.codingchili.core.context.SystemContext in project chili-core by codingchili.

the class ServiceLogHandlerTest method setUp.

@Before
public void setUp(TestContext test) {
    Async async = test.async();
    context = new LogContext(new SystemContext(), future);
    future.setHandler(done -> {
        context.storage().clear(clear -> {
            async.complete();
        });
        handler = new ServiceLogHandler(context);
    });
}
Also used : SystemContext(com.codingchili.core.context.SystemContext) Async(io.vertx.ext.unit.Async) LogContext(com.codingchili.logging.configuration.LogContext) Before(org.junit.Before)

Example 5 with SystemContext

use of com.codingchili.core.context.SystemContext in project chili-core by codingchili.

the class BenchmarkTests method setUp.

@Before
public void setUp() {
    context = new SystemContext();
    groups.add(new MockGroupBuilder(context, "mock-group-1", ITERATIONS));
    groups.add(new MockGroupBuilder(context, "mock-group-2", ITERATIONS));
    executor = new BenchmarkExecutor(context);
}
Also used : SystemContext(com.codingchili.core.context.SystemContext)

Aggregations

SystemContext (com.codingchili.core.context.SystemContext)16 Before (org.junit.Before)4 RealmContext (com.codingchili.realm.configuration.RealmContext)2 RealmSettings (com.codingchili.realm.configuration.RealmSettings)2 ListeningPerson (com.codingchili.realm.instance.model.npc.ListeningPerson)2 Async (io.vertx.ext.unit.Async)2 FileSystemMock (com.codingchili.core.testing.FileSystemMock)1 LogContext (com.codingchili.logging.configuration.LogContext)1 PatchContext (com.codingchili.patching.configuration.PatchContext)1 PatchHandler (com.codingchili.patching.controller.PatchHandler)1 SpellTarget (com.codingchili.realm.instance.model.spells.SpellTarget)1 RouterContext (com.codingchili.router.configuration.RouterContext)1 RouterSettings (com.codingchili.router.configuration.RouterSettings)1 JsonObject (io.vertx.core.json.JsonObject)1 BeforeClass (org.junit.BeforeClass)1