Advertisement
Slowhand-VI

perk_ms_h.fos

Dec 31st, 2015
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.91 KB | None | 0 0
  1. /**
  2.  *  Perk: Mysterious Stranger   -   Header
  3.  *
  4.  *  Description:
  5.  *      From time to time, a mysterious stranger will help the player, regarding the rules below.
  6.  *          0.  If the MS (Mysterious Stranger) dies, it will not spawn for X hours.
  7.  *          1.  Spawn rate of MS shall depend both on the players Charisma and Luck.
  8.  *              1.a. Chance for MS to spawn at random encounter: X + Y * CH + U * LK (Min V, Max Z)
  9.  *              1.b. Chance for MS to spawn for FA: X + CH * LK * U (Min V, Max Z)
  10.  *              1.c. Chance for MS to spawn for Doctor: X + CH * LK * U (Min V, Max Z)
  11.  *              1.d. If MS fails to spawn for FA or Doctor, a separate cooldown shall trigger: X / CHA;
  12.  *                      (This is needed because of mechanics, else whenever a crippled player gets attacked by someone,
  13.  *                       it will have an extra chance to spawn MS, changing the mechanic.)
  14.  *          2.  Special spawns shall depend on the players Charisma and the frequency on Luck.
  15.  *              2.a. Player drops below half a % of HP, chance for MS to spawn and try to FA the player.
  16.  *              2.b. Player gets crippled, chance for MS to spawn and try to FA and then Doctor the Player.
  17.  *              2.c. Player (not in group) spawns in the random encounter of the player, chance for MS to appear, warn and stay for a duration.
  18.  *              2.d. Special and normal spawns have a global cooldown.
  19.  *          3.  Players Charisma shall also affect the duration, cool down and strength of the MS.
  20.  *              3.a. Duration of aid lasts X + Y * CH turns in TB combat.
  21.  *              3.b. Duration of help lasts X + Y * CH seconds in RT combat.
  22.  *              3.c. Cooldown of special spawns and base MS spawn depends on CH: CD = X / CH minutes.
  23.  *              3.d. Level of MS shall be 3 levels higher than the owner.
  24.  *              3.e. Perk, stat and weapon composition of MS shall be better if the player has higher CH.
  25.  *              3.f. If the players Luck is below X, the MS may have the Jinxed Trait. Good luck!
  26.  *          4.  AI of MS:
  27.  *              4.a. If the player is attacked, the attacker is added to the MS's target list.
  28.  *              4.b. MS will try to FA the player, as long as he is in a reachable distance, if not, he will tell him to move closer.
  29.  *              4.c. MS will try to FA the player, if he is knocked out or in negative HP, but not dead.
  30.  *              4.d. If another player is attacking the owner, MS shall change target to it, possibly changing to a crowd control weapon, like rocket launcher or sniper riffle.
  31.  *          5.  Integration into projects/servers:
  32.  *              5.a. All of the parameters of the MS mechanic, shall be configurable.
  33.  *              5.b. Special triggers shall be disableable with macros from header.
  34.  *              5.c. Solutions shall be done without modifying crucial parts of modules, like combat.fos.
  35.  *              5.d. Integration shall be documented in the tutorial as well.
  36.  *
  37.  *  Author:     Slowhand
  38.  *  Reviewer:   n/a
  39.  *  Tested by:  Slowhand
  40.  *              Check perk_ms_test.fos for test details.
  41.  *  Known bugs: MS will skip first TB turn and has much more AP than it should. (15 instead of 10)
  42.  */
  43.  
  44. /**< TODO:  1. CRITTER_EVENT_TURN_BASED_PROCESS
  45.  *              - These events never get called, so I removed them, when SDK is ready, it can be added for TB AI.
  46.  *          2. Add different weapon arsenal to the 3rd level Mysterious Stranger.
  47.  *          3. Check character model compatibility with weapon types.
  48.  *          4. Fix the problem with repeatable FA/Doctor spawn. In case MS failed to spawn, it shall not try until some time.
  49.  *          5. Do the 1.d part, as that is missing. (in progress)
  50.  */
  51.  
  52. #ifndef __PERK_MS_H__
  53. #define __PERK_MS_H__
  54.  
  55. /**< Debug log for Mysterious Stranger perk */
  56. #define __MS_ALLOW_DEBUG_LOG__                          //  comment this line to disable debug mode for Mysterious Stranger perk related stuff.
  57.  
  58. #ifdef __MS_ALLOW_DEBUG_LOG__
  59.     #define MS_LOG                      # (__s)     { Log(__s); }
  60. #endif
  61. #ifndef __MS_ALLOW_DEBUG_LOG__
  62.     #define MS_LOG                      # (__s)     {; }
  63. #endif
  64.  
  65.  
  66. /**< Model parameters for different strength if the Mysterious Stranger */
  67. #define MS_PID_LEVEL1                   (36)        //  Gun thug, male, leather jacket. 36 - 408
  68. #define MS_PID_LEVEL2                   (403)       //  Leather jacket slaver guard.
  69. #define MS_PID_LEVEL3_BOS               (468)       //  APA Brotherhood of Steel guard.
  70. #define MS_PID_LEVEL3_ENC               (292)       //  APA Enclave guard.
  71. #define MS_PID_LEVEL3_GR                (518)       //  CA Gun Runners guard.
  72. #define MS_PID_LEVEL3_NRC               (475)       //  NCR Ranger.
  73.  
  74. /**< AI package used, the values have been modified at npc_ai.fos to support this perk. */
  75. #define MS_AI_PACK_USED                 (AIPACKET_MYSTERIOUS_STRANGER)
  76.  
  77. /**< Duration and cooldown parameters */
  78. #define MS_BASE_RESPAWN_CD              (6000)      //  MS base spawn CD time in real seconds
  79. #define MS_BASE_MEDICAL_SPAWN_BLOCK_CD  (100)       //  MS base medical spawn CD time in real seconds
  80. #define MS_BASE_DEATH_CD                (72000)     //  MS base re-birth time in real seconds
  81. #define MS_BASE_RT_DURATION             (20)        //  MS base duration in RT mode
  82. #define MS_RT_DURATION_FACTOR           (10)        //  MS duration extension factor in RT mode
  83.  
  84.  
  85. /**
  86.  *  Chance to spawn at encounter parameters
  87.  *  Formula:    X + Y * CH + U * LK (Min V, Max Z)
  88.  *  Function:   bool shallMsSpawnOnEncounter(uint playerId)
  89.  */
  90. #define MS_ENC_BASE_CHANCE              (5)
  91. #define MS_ENC_CHA_CHANCE_FACTOR        (2)
  92. #define MS_ENC_LK_CHANCE_FACTOR         (1)
  93. #define MS_ENC_MIN_CHANCE               (5)
  94. #define MS_ENC_MAX_CHANCE               (35)
  95.  
  96. /**
  97.  *  Chance to spawn when player below HP limit.
  98.  *  Formula:    FA: X + CH * LK (Min V, Max Z)
  99.  *  Function:   bool shallMsSpawnForFirstAid(uint playerId)
  100.  */
  101. #define MS_FA_BASE_CHANCE               (25)
  102. #define MS_FA_CHANCE_FACTOR             (5)
  103. #define MS_FA_MIN_CHANCE                (25)
  104. #define MS_FA_MAX_CHANCE                (65)
  105.  
  106. /**
  107.  *  Chance to spawn when player is crippled.
  108.  *  Formula:    FA: X + CH * LK (Min V, Max Z)
  109.  *  Function:   bool
  110.  */
  111. #define MS_DOC_BASE_CHANCE               (35)
  112. #define MS_DOC_CHANCE_FACTOR             (5)
  113. #define MS_DOC_MIN_CHANCE                (35)
  114. #define MS_DOC_MAX_CHANCE                (85)
  115.  
  116. /**<
  117.  * Add TC town maps, or any other map that MS shall not appear at.
  118.  * Other options are to disable Mysterious Stranger in TC towns with location.isTCTown(), but this way other towns can be disabled as well.
  119.  * Note: Only the base map of the TC maps is disabled, so the MS could spawn in other areas of the map, like the mines in Redding or Broken Hills.
  120.  */
  121. array<string> disabledMsMaps = {"den", "klamath", "modoc", "gecko", "broken", "redding"};
  122.  
  123. #endif  //  __PERK_MS_H__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement