Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <DynRPG/DynRPG.h>
- #define NOT_MAIN_MODULE
- //#include <sstream>
- //std::map<std::string, std::string> configuration;
- //unsigned short int confConditionId;
- //unsigned short int confSkillId;
- int reflectTargetId;
- int reflectedSkillId;
- bool testBool;
- int battlerId;
- int frameTimer;
- /*bool onStartup (char *pluginName) {
- configuration = RPG::loadConfiguration(pluginName);
- confConditionId = atoi(configuration["ConditionId"].c_str());
- return true;
- }*/
- /** WORKING, but buggy **/
- // Hero to Monster
- void onFrame (RPG::Scene scene) {
- if (testBool == true && scene == RPG::SCENE_BATTLE) {
- if (frameTimer != 0) frameTimer++;
- if (frameTimer > 5) {
- frameTimer = 0;
- RPG::updateBattle();
- }
- }
- }
- bool onDoBattlerAction (RPG::Battler* battler, bool firstTry){
- //MessageBox(NULL, "what happen", "Debug", MB_ICONINFORMATION); // this shows when onDoBattlerAction is called
- // and how many times (basically random)
- if (testBool == true) {
- testBool = false;
- battler->action->kind = RPG::AK_SKILL; // Ensures the kind is set to skill
- battler->action->skillId = reflectedSkillId; // Force the skill ID to be the skill that needs to be reflected
- battler->action->target = RPG::TARGET_ACTOR; // Ensures the target is an actor
- battler->action->targetId = reflectTargetId; // Gets the zero-based party index
- } else if (battler->action->kind == RPG::AK_SKILL // STARTS HERE
- && battler->isMonster() == false // battler must be hero
- && battler->action->target == RPG::TARGET_MONSTER
- && RPG::monsters[battler->action->targetId]->conditions[9] != 0 // the reflect condition
- && firstTry == true) { // only perform the action on the first try
- reflectedSkillId = battler->action->skillId; // saves the skill ID
- int i;
- for (i=0; i<4; i++){ // gets the hero's zero-based party index to be passed back to the targetId
- if (RPG::Actor::partyMember(i)->id == battler->id){
- battlerId = i;
- reflectTargetId = i;
- break;
- }
- }
- testBool = true;
- frameTimer = 1;
- }
- return true;
- }
- bool onBattlerActionDone(RPG::Battler* battler, bool success) {
- if (battler->action->kind == RPG::AK_SKILL // STARTS HERE
- && battler->isMonster() == false // battler must be hero
- && battler->action->target == RPG::TARGET_MONSTER
- && RPG::monsters[battler->action->targetId]->conditions[9] != 0
- && testBool == true) {
- // at this point, the animation has already been shown,
- // so this stops the dmaage from being made to the target.
- //battler->action->target = RPG::TARGET_NONE;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement