Advertisement
PepsiOtaku

DynRPG - Reflect/Counter Hell

Jan 2nd, 2014
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. #include <DynRPG/DynRPG.h>
  2. #define NOT_MAIN_MODULE
  3. //#include <sstream>
  4.  
  5. //std::map<std::string, std::string> configuration;
  6.  
  7. //unsigned short int confConditionId;
  8. //unsigned short int confSkillId;
  9. int reflectTargetId;
  10. int reflectedSkillId;
  11. bool testBool;
  12. int battlerId;
  13. int frameTimer;
  14.  
  15. /*bool onStartup (char *pluginName) {
  16. configuration = RPG::loadConfiguration(pluginName);
  17. confConditionId = atoi(configuration["ConditionId"].c_str());
  18. return true;
  19. }*/
  20.  
  21. /** WORKING, but buggy **/
  22. // Hero to Monster
  23.  
  24. void onFrame (RPG::Scene scene) {
  25. if (testBool == true && scene == RPG::SCENE_BATTLE) {
  26. if (frameTimer != 0) frameTimer++;
  27. if (frameTimer > 5) {
  28. frameTimer = 0;
  29. RPG::updateBattle();
  30. }
  31. }
  32. }
  33.  
  34. bool onDoBattlerAction (RPG::Battler* battler, bool firstTry){
  35. //MessageBox(NULL, "what happen", "Debug", MB_ICONINFORMATION); // this shows when onDoBattlerAction is called
  36. // and how many times (basically random)
  37. if (testBool == true) {
  38. testBool = false;
  39. battler->action->kind = RPG::AK_SKILL; // Ensures the kind is set to skill
  40. battler->action->skillId = reflectedSkillId; // Force the skill ID to be the skill that needs to be reflected
  41. battler->action->target = RPG::TARGET_ACTOR; // Ensures the target is an actor
  42. battler->action->targetId = reflectTargetId; // Gets the zero-based party index
  43. } else if (battler->action->kind == RPG::AK_SKILL // STARTS HERE
  44. && battler->isMonster() == false // battler must be hero
  45. && battler->action->target == RPG::TARGET_MONSTER
  46. && RPG::monsters[battler->action->targetId]->conditions[9] != 0 // the reflect condition
  47. && firstTry == true) { // only perform the action on the first try
  48. reflectedSkillId = battler->action->skillId; // saves the skill ID
  49. int i;
  50. for (i=0; i<4; i++){ // gets the hero's zero-based party index to be passed back to the targetId
  51. if (RPG::Actor::partyMember(i)->id == battler->id){
  52. battlerId = i;
  53. reflectTargetId = i;
  54. break;
  55. }
  56. }
  57. testBool = true;
  58. frameTimer = 1;
  59. }
  60. return true;
  61. }
  62. bool onBattlerActionDone(RPG::Battler* battler, bool success) {
  63. if (battler->action->kind == RPG::AK_SKILL // STARTS HERE
  64. && battler->isMonster() == false // battler must be hero
  65. && battler->action->target == RPG::TARGET_MONSTER
  66. && RPG::monsters[battler->action->targetId]->conditions[9] != 0
  67. && testBool == true) {
  68. // at this point, the animation has already been shown,
  69. // so this stops the dmaage from being made to the target.
  70. //battler->action->target = RPG::TARGET_NONE;
  71. }
  72.  
  73. return true;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement