Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 63 lines (53 sloc) 2.344 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
/*
* illarionserver - server for the game Illarion
* Copyright 2011 Illarion e.V.
*
* This file is part of illarionserver.
*
* illarionserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* illarionserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with illarionserver. If not, see <http://www.gnu.org/licenses/>.
*/

#include "LuaLongTimeEffectScript.hpp"

#include "luabind/luabind.hpp"
#include "Character.hpp"
#include "LongTimeEffect.hpp"
#include "fuse_ptr.hpp"

LuaLongTimeEffectScript::LuaLongTimeEffectScript(std::string filename, LongTimeEffectStruct effectStruct) throw(ScriptException)
    : LuaScript(filename), _effectStruct(effectStruct) {
    init_functions();
}

LuaLongTimeEffectScript::~LuaLongTimeEffectScript() throw() {}

void LuaLongTimeEffectScript::init_functions() {
    luabind::object globals = luabind::globals(_luaState);
    globals["thisEffect"] = _effectStruct;
}

bool LuaLongTimeEffectScript::callEffect(LongTimeEffect *effect, Character *target) {
    fuse_ptr<Character> fuse_target(target);
    return callEntrypoint<bool>("callEffect", effect, fuse_target);
}

void LuaLongTimeEffectScript::doubleEffect(LongTimeEffect *effect, Character *target) {
    fuse_ptr<Character> fuse_target(target);
    callEntrypoint("doubleEffect", effect, fuse_target);
}

void LuaLongTimeEffectScript::loadEffect(LongTimeEffect *effect, Character *target) {
    fuse_ptr<Character> fuse_target(target);
    callEntrypoint("loadEffect", effect, fuse_target);
}

void LuaLongTimeEffectScript::addEffect(LongTimeEffect *effect, Character *target) {
    fuse_ptr<Character> fuse_target(target);
    callEntrypoint("addEffect", effect, fuse_target);
}

void LuaLongTimeEffectScript::removeEffect(LongTimeEffect *effect, Character *target) {
    fuse_ptr<Character> fuse_target(target);
    callEntrypoint("removeEffect", effect, fuse_target);
}
Something went wrong with that request. Please try again.