KNpcAttribModify.cpp
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:33k
源码类别:

模拟服务器

开发平台:

C/C++

  1. #include "KCore.h"
  2. #include "KNpc.h"
  3. #include "KPlayer.h"
  4. #include "KNpcAttribModify.h"
  5. #ifndef max
  6. #define max(a,b)            (((a) > (b)) ? (a) : (b))
  7. #endif
  8. KNpcAttribModify g_NpcAttribModify;
  9. KNpcAttribModify::KNpcAttribModify()
  10. {
  11. ZeroMemory(ProcessFunc, sizeof(ProcessFunc));
  12. ProcessFunc[magic_physicsresmax_p] = &KNpcAttribModify::PhysicsResMaxP;
  13. ProcessFunc[magic_coldresmax_p] = &KNpcAttribModify::ColdResMaxP;
  14. ProcessFunc[magic_fireresmax_p] = &KNpcAttribModify::FireResMaxP;
  15. ProcessFunc[magic_lightingresmax_p] = &KNpcAttribModify::LightingResMaxP;
  16. ProcessFunc[magic_poisonresmax_p] = &KNpcAttribModify::PoisonResMaxP;
  17. ProcessFunc[magic_allresmax_p] = &KNpcAttribModify::AllResMaxP;
  18. ProcessFunc[magic_lifepotion_v] = &KNpcAttribModify::LifePotionV;
  19. ProcessFunc[magic_manapotion_v] = &KNpcAttribModify::ManaPotionV;
  20. ProcessFunc[magic_meleedamagereturn_v] = &KNpcAttribModify::MeleeDamageReturnV;
  21. ProcessFunc[magic_meleedamagereturn_p] = &KNpcAttribModify::MeleeDamageReturnP;
  22. ProcessFunc[magic_rangedamagereturn_v] = &KNpcAttribModify::RangeDamageReturnV;
  23. ProcessFunc[magic_rangedamagereturn_p] = &KNpcAttribModify::RangeDamageReturnP;
  24. ProcessFunc[magic_damagetomana_p] = &KNpcAttribModify::Damage2ManaP;
  25. ProcessFunc[magic_adddefense_v] = &KNpcAttribModify::ArmorDefenseV; // 与装备加防御统一处理
  26. ProcessFunc[magic_poisonenhance_p] = &KNpcAttribModify::PoisonEnhanceP;
  27. ProcessFunc[magic_lightingenhance_p] = &KNpcAttribModify::LightingEnhanceP;
  28. ProcessFunc[magic_fireenhance_p] = &KNpcAttribModify::FireEnhanceP;
  29. ProcessFunc[magic_coldenhance_p] = &KNpcAttribModify::ColdEnhanceP;
  30. ProcessFunc[magic_armordefense_v] = &KNpcAttribModify::ArmorDefenseV;
  31. ProcessFunc[magic_lifemax_v] = &KNpcAttribModify::LifeMaxV;
  32. ProcessFunc[magic_lifemax_p] = &KNpcAttribModify::LifeMaxP;
  33. ProcessFunc[magic_life_v] = &KNpcAttribModify::LifeV;
  34. ProcessFunc[magic_lifereplenish_v] = &KNpcAttribModify::LifeReplenishV;
  35. ProcessFunc[magic_manamax_v] = &KNpcAttribModify::ManaMaxV;
  36. ProcessFunc[magic_manamax_p] = &KNpcAttribModify::ManaMaxP;
  37. ProcessFunc[magic_mana_v] = &KNpcAttribModify::ManaV;
  38. ProcessFunc[magic_manareplenish_v] = &KNpcAttribModify::ManaReplenishV;
  39. ProcessFunc[magic_staminamax_v] = &KNpcAttribModify::StaminaMaxV;
  40. ProcessFunc[magic_staminamax_p] = &KNpcAttribModify::StaminaMaxP;
  41. ProcessFunc[magic_stamina_v] = &KNpcAttribModify::StaminaV;
  42. ProcessFunc[magic_staminareplenish_v] = &KNpcAttribModify::StaminaReplenishV;
  43. ProcessFunc[magic_strength_v] = &KNpcAttribModify::StrengthV;
  44. ProcessFunc[magic_dexterity_v] = &KNpcAttribModify::DexterityV;
  45. ProcessFunc[magic_vitality_v] = &KNpcAttribModify::VitalityV;
  46. ProcessFunc[magic_energy_v] = &KNpcAttribModify::EnergyV;
  47. ProcessFunc[magic_poisonres_p] = &KNpcAttribModify::PoisonresP;
  48. ProcessFunc[magic_fireres_p] = &KNpcAttribModify::FireresP;
  49. ProcessFunc[magic_lightingres_p] = &KNpcAttribModify::LightingresP;
  50. ProcessFunc[magic_physicsres_p] = &KNpcAttribModify::PhysicsresP;
  51. ProcessFunc[magic_coldres_p] = &KNpcAttribModify::ColdresP;
  52. ProcessFunc[magic_freezetimereduce_p] = &KNpcAttribModify::FreezeTimeReduceP;
  53. ProcessFunc[magic_burntimereduce_p] = &KNpcAttribModify::BurnTimeReduceP;
  54. ProcessFunc[magic_poisontimereduce_p] = &KNpcAttribModify::PoisonTimeReduceP;
  55. ProcessFunc[magic_poisondamagereduce_v] = &KNpcAttribModify::PoisonDamageReduceV;
  56. ProcessFunc[magic_stuntimereduce_p] = &KNpcAttribModify::StunTimeReduceP;
  57. ProcessFunc[magic_fastwalkrun_p] = &KNpcAttribModify::FastWalkRunP;
  58. ProcessFunc[magic_visionradius_p] = &KNpcAttribModify::VisionRadiusP;
  59. ProcessFunc[magic_fasthitrecover_v] = &KNpcAttribModify::FastHitRecoverV;
  60. ProcessFunc[magic_allres_p] = &KNpcAttribModify::AllresP;
  61. ProcessFunc[magic_attackrating_v] = &KNpcAttribModify::AttackRatingV;
  62. ProcessFunc[magic_attackratingenhance_v] = &KNpcAttribModify::AttackRatingV;
  63. ProcessFunc[magic_attackrating_p] = &KNpcAttribModify::AttackRatingP;
  64. ProcessFunc[magic_attackratingenhance_p] = &KNpcAttribModify::AttackRatingP;
  65. ProcessFunc[magic_attackspeed_v] = &KNpcAttribModify::AttackSpeedV;
  66. ProcessFunc[magic_castspeed_v] = &KNpcAttribModify::CastSpeedV;
  67. ProcessFunc[magic_addphysicsdamage_v] = &KNpcAttribModify::AddPhysicsDamageV;
  68. ProcessFunc[magic_addfiredamage_v] = &KNpcAttribModify::AddFireDamageV;
  69. ProcessFunc[magic_addcolddamage_v] = &KNpcAttribModify::AddColdDamageV;
  70. ProcessFunc[magic_addlightingdamage_v] = &KNpcAttribModify::AddLightingDamageV;
  71. ProcessFunc[magic_addpoisondamage_v] = &KNpcAttribModify::AddPoisonDamageV;
  72. ProcessFunc[magic_addphysicsdamage_p] = &KNpcAttribModify::AddPhysicsDamageP;
  73. ProcessFunc[magic_slowmissle_b] = &KNpcAttribModify::SlowMissleB;
  74. ProcessFunc[magic_changecamp_b] = &KNpcAttribModify::ChangeCampV;
  75. ProcessFunc[magic_physicsarmor_v] = &KNpcAttribModify::PhysicsArmorV;
  76. ProcessFunc[magic_coldarmor_v] = &KNpcAttribModify::ColdArmorV;
  77. ProcessFunc[magic_firearmor_v] = &KNpcAttribModify::FireArmorV;
  78. ProcessFunc[magic_poisonarmor_v] = &KNpcAttribModify::PoisonArmorV;
  79. ProcessFunc[magic_lightingarmor_v] = &KNpcAttribModify::LightingArmorV;
  80. ProcessFunc[magic_lucky_v] = &KNpcAttribModify::LuckyV;
  81. ProcessFunc[magic_steallife_p] = &KNpcAttribModify::StealLifeP;
  82. ProcessFunc[magic_steallifeenhance_p] = &KNpcAttribModify::StealLifeP;
  83. ProcessFunc[magic_stealstamina_p] = &KNpcAttribModify::StealStaminaP;
  84. ProcessFunc[magic_stealstaminaenhance_p] = &KNpcAttribModify::StealStaminaP;
  85. ProcessFunc[magic_stealmana_p] = &KNpcAttribModify::StealManaP;
  86. ProcessFunc[magic_stealmanaenhance_p] = &KNpcAttribModify::StealManaP;
  87. ProcessFunc[magic_allskill_v] = &KNpcAttribModify::AllSkillV;
  88. ProcessFunc[magic_metalskill_v] = &KNpcAttribModify::MetalSkillV;
  89. ProcessFunc[magic_woodskill_v] = &KNpcAttribModify::WoodSkillV;
  90. ProcessFunc[magic_waterskill_v] = &KNpcAttribModify::WaterSkillV;
  91. ProcessFunc[magic_fireskill_v] = &KNpcAttribModify::FireSkillV;
  92. ProcessFunc[magic_earthskill_v] = &KNpcAttribModify::EarthSkillV;
  93. ProcessFunc[magic_knockback_p] = &KNpcAttribModify::KnockBackP;
  94. ProcessFunc[magic_knockbackenhance_p] = &KNpcAttribModify::KnockBackP;
  95. ProcessFunc[magic_deadlystrike_p] = &KNpcAttribModify::DeadlyStrikeP;
  96. ProcessFunc[magic_deadlystrikeenhance_p] = &KNpcAttribModify::DeadlyStrikeP;
  97. ProcessFunc[magic_badstatustimereduce_v] = &KNpcAttribModify::FatallyStrikeP;
  98. ProcessFunc[magic_manashield_p] = &KNpcAttribModify::ManaShieldP;
  99. }
  100. KNpcAttribModify::~KNpcAttribModify()
  101. {
  102. }
  103. void KNpcAttribModify::ModifyAttrib(KNpc* pNpc, void* pData)
  104. {
  105. if (!pData || !pNpc)
  106. return;
  107. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  108. if (pMagic->nAttribType < 0 || pMagic->nAttribType >= magic_normal_end || NULL == ProcessFunc[pMagic->nAttribType])
  109. return;
  110. (this->*ProcessFunc[pMagic->nAttribType])(pNpc, pData);
  111. }
  112. void KNpcAttribModify::AddColdDamageV(KNpc* pNpc, void* pData)
  113. {
  114. #define defNORMAL_COLD_TIME 60
  115. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  116. pNpc->m_CurrentColdDamage.nValue[0] += pMagic->nValue[0];
  117. pNpc->m_CurrentColdDamage.nValue[2] += pMagic->nValue[0];
  118. if (pNpc->m_CurrentColdDamage.nValue[0] > 0 && pNpc->m_CurrentColdDamage.nValue[2] > 0)
  119. pNpc->m_CurrentColdDamage.nValue[1] = defNORMAL_COLD_TIME;
  120. else
  121. {
  122. pNpc->m_CurrentColdDamage.nValue[0] = 0;
  123. pNpc->m_CurrentColdDamage.nValue[1] = 0;
  124. pNpc->m_CurrentColdDamage.nValue[2] = 0;
  125. }
  126. g_DebugLog("[数值]%s冰伤害增加(%d)", pNpc->Name, pMagic->nValue[0]);
  127. }
  128. void KNpcAttribModify::AddFireDamageV(KNpc* pNpc, void* pData)
  129. {
  130. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  131. pNpc->m_CurrentFireDamage.nValue[0] += pMagic->nValue[0];
  132. pNpc->m_CurrentFireDamage.nValue[2] += pMagic->nValue[0];
  133. g_DebugLog("[数值]%s火伤害增加(%d)", pNpc->Name, pMagic->nValue[0]);
  134. }
  135. void KNpcAttribModify::AddLightingDamageV(KNpc* pNpc, void* pData)
  136. {
  137. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  138. pNpc->m_CurrentLightDamage.nValue[0] += pMagic->nValue[0];
  139. pNpc->m_CurrentLightDamage.nValue[2] += pMagic->nValue[0];
  140. g_DebugLog("[数值]%s电伤害增加(%d)", pNpc->Name, pMagic->nValue[0]);
  141. }
  142. void KNpcAttribModify::AddPhysicsDamageP(KNpc* pNpc, void* pData)
  143. {
  144. #define WEAPON_ALL ((MAX_MELEE_WEAPON) + 0)
  145. #define WEAPON_RANGE_ALL ((MAX_MELEE_WEAPON) + 1)
  146. #define WEAPON_MELEE_ALL ((MAX_MELEE_WEAPON) + 2)
  147. #define WEAPON_NONE ((MAX_MELEE_WEAPON) + 3)
  148. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  149. int nType = abs(pMagic->nValue[2]);
  150. if (nType == WEAPON_ALL)
  151. {
  152. for (int i = 0; i < MAX_MELEE_WEAPON; i++)
  153. {
  154. pNpc->m_CurrentMeleeEnhance[i] += pMagic->nValue[0];
  155. }
  156. pNpc->m_CurrentHandEnhance += pMagic->nValue[0];
  157. pNpc->m_CurrentRangeEnhance += pMagic->nValue[0];
  158. g_DebugLog("[数值]%s所有物理攻击力增加百分之%d", pNpc->Name, pMagic->nValue[0]);
  159. }
  160. else if (nType == WEAPON_RANGE_ALL)
  161. {
  162. pNpc->m_CurrentRangeEnhance += pMagic->nValue[0];
  163. g_DebugLog("[数值]%s远程物理攻击力增加百分之%d", pNpc->Name, pMagic->nValue[0]);
  164. }
  165. else if (nType == WEAPON_NONE)
  166. {
  167. pNpc->m_CurrentHandEnhance += pMagic->nValue[0];
  168. g_DebugLog("[数值]%s空手物理攻击力增加百分之%d", pNpc->Name, pMagic->nValue[0]);
  169. }
  170. else if (nType == WEAPON_MELEE_ALL)
  171. {
  172. for (int i = 0; i < MAX_MELEE_WEAPON; i++)
  173. {
  174. pNpc->m_CurrentMeleeEnhance[i] += pMagic->nValue[0];
  175. }
  176. g_DebugLog("[数值]%s近程物理攻击力增加百分之%d", pNpc->Name, pMagic->nValue[0]);
  177. }
  178. else if (nType >= 0 && nType < MAX_MELEE_WEAPON)
  179. {
  180. pNpc->m_CurrentMeleeEnhance[nType] += pMagic->nValue[0];
  181. g_DebugLog("[数值]%s近程武器%d物理攻击力增加百分之%d", pNpc->Name, nType, pMagic->nValue[0]);
  182. }
  183. }
  184. void KNpcAttribModify::AddPoisonDamageV(KNpc* pNpc, void* pData)
  185. {
  186. #define defPOISON_DAMAGE_TIME 60
  187. #define defPOISON_DAMAGE_INTERVAL 10
  188. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  189. pNpc->m_CurrentPoisonDamage.nValue[0] += pMagic->nValue[0];
  190. if (pNpc->m_CurrentPoisonDamage.nValue[0] > 0)
  191. {
  192. pNpc->m_CurrentPoisonDamage.nValue[1] = defPOISON_DAMAGE_TIME;//pMagic->nValue[1];
  193. pNpc->m_CurrentPoisonDamage.nValue[2] = defPOISON_DAMAGE_INTERVAL;//pMagic->nValue[2];
  194. }
  195. else
  196. {
  197. pNpc->m_CurrentPoisonDamage.nValue[0] = 0;
  198. pNpc->m_CurrentPoisonDamage.nValue[1] = 0;
  199. pNpc->m_CurrentPoisonDamage.nValue[2] = 0;
  200. }
  201. g_DebugLog("[数值]%s毒状态变为:间隔%d帧发作一次%d伤害,共持续%d帧", pNpc->Name, pNpc->m_CurrentPoisonDamage.nValue[2], pNpc->m_CurrentPoisonDamage.nValue[0], pNpc->m_CurrentPoisonDamage.nValue[1]);
  202. }
  203. void KNpcAttribModify::AddPhysicsDamageV(KNpc* pNpc, void* pData)
  204. {
  205. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  206. // pNpc->m_PhysicsDamage.nValue[0] += pMagic->nValue[0];
  207. // pNpc->m_PhysicsDamage.nValue[2] += pMagic->nValue[0];
  208. pNpc->m_CurrentAddPhysicsDamage += pMagic->nValue[0];
  209. g_DebugLog("[数值]%s物理伤害力增加(%d)", pNpc->Name, pMagic->nValue[0]);
  210. }
  211. void KNpcAttribModify::AllresP(KNpc* pNpc, void* pData)
  212. {
  213. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  214. pNpc->m_CurrentFireResist += pMagic->nValue[0];
  215. pNpc->m_CurrentColdResist += pMagic->nValue[0];
  216. pNpc->m_CurrentLightResist += pMagic->nValue[0];
  217. pNpc->m_CurrentPoisonResist += pMagic->nValue[0];
  218. pNpc->m_CurrentPhysicsResist += pMagic->nValue[0];
  219. g_DebugLog("[数值]%s五防抗性增加%d", pNpc->Name, pMagic->nValue[0]);
  220. }
  221. void KNpcAttribModify::AllSkillV(KNpc* pNpc, void* pData)
  222. {
  223. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  224. g_DebugLog("[数值]%s所有技能加%d级,未完成", pNpc->Name, pMagic->nValue[0]);
  225. }
  226. void KNpcAttribModify::AttackRatingP(KNpc* pNpc, void* pData)
  227. {
  228. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  229. pNpc->m_CurrentAttackRating += pNpc->m_AttackRating * pMagic->nValue[0] / 100;
  230. g_DebugLog("[数值]%s命中率增加百分之%d(%d点)", pNpc->Name, pMagic->nValue[0], pNpc->m_AttackRating * pMagic->nValue[0] / 100);
  231. }
  232. void KNpcAttribModify::AttackRatingV(KNpc* pNpc, void* pData)
  233. {
  234. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  235. pNpc->m_CurrentAttackRating += pMagic->nValue[0];
  236. g_DebugLog("[数值]%s五防抗性增加%d", pNpc->Name, pMagic->nValue[0]);
  237. }
  238. void KNpcAttribModify::AttackSpeedV(KNpc* pNpc, void* pData)
  239. {
  240. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  241. pNpc->m_CurrentAttackSpeed += pMagic->nValue[0];
  242. g_DebugLog("[数值]%s攻击速度增加%d", pNpc->Name, pMagic->nValue[0]);
  243. }
  244. void KNpcAttribModify::BadStatusTimeReduceV(KNpc* pNpc, void* pData)
  245. {
  246. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  247. return;
  248. }
  249. void KNpcAttribModify::BurnTimeReduceP(KNpc* pNpc, void* pData)
  250. {
  251. return;
  252. }
  253. void KNpcAttribModify::CastSpeedV(KNpc* pNpc, void* pData)
  254. {
  255. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  256. pNpc->m_CurrentCastSpeed += pMagic->nValue[0];
  257. g_DebugLog("[数值]%s施法速度增加%d", pNpc->Name, pMagic->nValue[0]);
  258. }
  259. void KNpcAttribModify::ChangeCampV(KNpc* pNpc, void* pData)
  260. {
  261. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  262. if (pNpc->m_Kind != kind_player)
  263. {
  264. if (pMagic->nValue[0] > 0 && pMagic->nValue[0] < camp_num)
  265. pNpc->m_CurrentCamp = pMagic->nValue[0];
  266. else
  267. pNpc->m_CurrentCamp = pNpc->m_Camp;
  268. g_DebugLog("[数值]%s当前阵营变为%d", pNpc->Name, pMagic->nValue[0]);
  269. }
  270. }
  271. void KNpcAttribModify::ColdArmorV(KNpc* pNpc, void* pData)
  272. {
  273. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  274. if (pMagic->nValue[0] > 0)
  275. {
  276. pNpc->m_ColdArmor.nValue[0] = pMagic->nValue[0];
  277. pNpc->m_ColdArmor.nTime = pMagic->nValue[1];
  278. g_DebugLog("[数值]%s冰护盾变为%d点持续%d帧", pNpc->Name, pMagic->nValue[0], pMagic->nValue[1]);
  279. }
  280. else
  281. {
  282. pNpc->m_ColdArmor.nValue[0] = 0;
  283. pNpc->m_ColdArmor.nTime = 0;
  284. g_DebugLog("[数值]%s冰护盾消失", pNpc->Name);
  285. }
  286. }
  287. void KNpcAttribModify::ColdresP(KNpc* pNpc, void* pData)
  288. {
  289. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  290. pNpc->m_CurrentColdResist += pMagic->nValue[0];
  291. g_DebugLog("[数值]%s冰抗性增加了%d点", pNpc->Name, pMagic->nValue[0]);
  292. }
  293. void KNpcAttribModify::DeadlyStrikeP(KNpc* pNpc, void* pData)
  294. {
  295. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  296. pNpc->m_CurrentDeadlyStrike += pMagic->nValue[0];
  297. g_DebugLog("[数值]%s致命一击百分比增加%d", pNpc->Name, pMagic->nValue[0]);
  298. }
  299. void KNpcAttribModify::DexterityV(KNpc* pNpc, void* pData)
  300. {
  301. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  302. if (pNpc->m_Kind != kind_player)
  303. return;;
  304. if (pNpc->m_nPlayerIdx <= 0)
  305. return;
  306. Player[pNpc->m_nPlayerIdx].ChangeCurDexterity(pMagic->nValue[0]);
  307. g_DebugLog("[数值]%s当前敏捷增加了%d点", pNpc->Name, pMagic->nValue[0]);
  308. }
  309. void KNpcAttribModify::EarthSkillV(KNpc* pNpc, void* pData)
  310. {
  311. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  312. g_DebugLog("[数值]%s土系技能加%d级", pNpc->Name, pMagic->nValue[0]);
  313. }
  314. void KNpcAttribModify::EnergyV(KNpc* pNpc, void* pData)
  315. {
  316. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  317. if (pNpc->m_Kind != kind_player)
  318. return;
  319. if (pNpc->m_nPlayerIdx <= 0)
  320. return;
  321. Player[pNpc->m_nPlayerIdx].ChangeCurEngergy(pMagic->nValue[0]);
  322. g_DebugLog("[数值]%s当前精力增加了%d点", pNpc->Name, pMagic->nValue[0]);
  323. }
  324. void KNpcAttribModify::FastHitRecoverV(KNpc* pNpc, void* pData)
  325. {
  326. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  327. pNpc->m_CurrentHitRecover += pMagic->nValue[0];
  328. g_DebugLog("[数值]%s快速命中回复增加%d", pNpc->Name, pMagic->nValue[0]);
  329. }
  330. void KNpcAttribModify::FastWalkRunP(KNpc* pNpc, void* pData)
  331. {
  332. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  333. // 文档要求修改为直接加点数
  334. pNpc->m_CurrentWalkSpeed += (pNpc->m_WalkSpeed * pMagic->nValue[0]) / 100;
  335. pNpc->m_CurrentRunSpeed += (pNpc->m_RunSpeed * pMagic->nValue[0]) / 100;
  336. g_DebugLog("[数值]%s移动速度增加%d", pNpc->Name, pMagic->nValue[0]);
  337. }
  338. void KNpcAttribModify::FireArmorV(KNpc* pNpc, void* pData)
  339. {
  340. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  341. if (pMagic->nValue[0] > 0)
  342. {
  343. pNpc->m_FireArmor.nValue[0] = pMagic->nValue[0];
  344. pNpc->m_FireArmor.nTime = pMagic->nValue[1];
  345. g_DebugLog("[数值]%s火护盾变为%d点持续%d帧", pNpc->Name, pMagic->nValue[0], pMagic->nValue[1]);
  346. }
  347. else
  348. {
  349. pNpc->m_FireArmor.nValue[0] = 0;
  350. pNpc->m_FireArmor.nTime = 0;
  351. g_DebugLog("[数值]%s火护盾消失", pNpc->Name);
  352. }
  353. }
  354. void KNpcAttribModify::FireSkillV(KNpc* pNpc, void* pData)
  355. {
  356. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  357. g_DebugLog("[数值]%s火系技能加%d级", pNpc->Name, pMagic->nValue[0]);
  358. }
  359. void KNpcAttribModify::FreezeTimeReduceP(KNpc* pNpc, void* pData)
  360. {
  361. // KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  362. // pNpc->m_FreezeState.nTime *= (100 - pMagic->nValue[0]);
  363. // pNpc->m_FreezeState.nTime /= 100;
  364. // if (pNpc->m_FreezeState.nTime <= 0)
  365. // {
  366. // pNpc->m_FreezeState.nTime = 0;
  367. // }
  368. // g_DebugLog("[数值]%s冰冻时间减少百分之%d", pNpc->Name, pMagic->nValue[0]);
  369. // 装备TODO
  370. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  371. pNpc->m_CurrentFreezeTimeReducePercent += pMagic->nValue[0];
  372. g_DebugLog("[数值]%s冰冻时间减少百分之%d", pNpc->Name, pMagic->nValue[0]);
  373. }
  374. void KNpcAttribModify::KnockBackP(KNpc* pNpc, void* pData)
  375. {
  376. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  377. pNpc->m_CurrentKnockBack += pMagic->nValue[0];
  378. g_DebugLog("[数值]%s震退百分比增加%d", pNpc->Name, pMagic->nValue[0]);
  379. }
  380. void KNpcAttribModify::LifeMaxP(KNpc* pNpc, void* pData)
  381. {
  382. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  383. pNpc->m_CurrentLifeMax += pNpc->m_LifeMax * pMagic->nValue[0] / 100;
  384. g_DebugLog("[数值]%s生命上限增加了百分之%d(%d点)", pNpc->Name, pMagic->nValue[0], pNpc->m_LifeMax * pMagic->nValue[0] / 100);
  385. }
  386. void KNpcAttribModify::LifeMaxV(KNpc* pNpc, void* pData)
  387. {
  388. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  389. pNpc->m_CurrentLifeMax += pMagic->nValue[0];
  390. g_DebugLog("[数值]%s生命上限增加了%d点", pNpc->Name, pMagic->nValue[0]);
  391. }
  392. void KNpcAttribModify::LifeReplenishV(KNpc* pNpc, void* pData)
  393. {
  394. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  395. pNpc->m_CurrentLifeReplenish += pMagic->nValue[0];
  396. g_DebugLog("[数值]%s生命回复速度增加了%d点", pNpc->Name, pMagic->nValue[0]);
  397. }
  398. void KNpcAttribModify::LifeV(KNpc* pNpc, void* pData)
  399. {
  400. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  401. pNpc->m_CurrentLife += pMagic->nValue[0];
  402. g_DebugLog("[数值]%s生命增加了%d点", pNpc->Name, pMagic->nValue[0]);
  403. }
  404. void KNpcAttribModify::LightingArmorV(KNpc* pNpc, void* pData)
  405. {
  406. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  407. if (pMagic->nValue[0] > 0)
  408. {
  409. pNpc->m_LightArmor.nValue[0] = pMagic->nValue[0];
  410. pNpc->m_LightArmor.nTime = pMagic->nValue[1];
  411. g_DebugLog("[数值]%s电护盾变为%d点持续%d帧", pNpc->Name, pMagic->nValue[0], pMagic->nValue[1]);
  412. }
  413. else
  414. {
  415. pNpc->m_LightArmor.nValue[0] = 0;
  416. pNpc->m_LightArmor.nTime = 0;
  417. g_DebugLog("[数值]%s电护盾消失", pNpc->Name);
  418. }
  419. }
  420. void KNpcAttribModify::LightingresP(KNpc* pNpc, void* pData)
  421. {
  422. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  423. pNpc->m_CurrentLightResist += pMagic->nValue[0];
  424. g_DebugLog("[数值]%s电抗性增加了%d点", pNpc->Name, pMagic->nValue[0]);
  425. }
  426. void KNpcAttribModify::LuckyV(KNpc* pNpc, void* pData)
  427. {
  428. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  429. if (pNpc->IsPlayer())
  430. {
  431. g_DebugLog("[数值]%sMF值增加了%d,未完成", pNpc->Name, pMagic->nValue[0]);
  432. }
  433. }
  434. void KNpcAttribModify::ManaMaxP(KNpc* pNpc, void* pData)
  435. {
  436. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  437. pNpc->m_CurrentManaMax += pNpc->m_ManaMax * pMagic->nValue[0] / 100;
  438. g_DebugLog("[数值]%s内力上限增加了百分之%d(%d点)", pNpc->Name, pMagic->nValue[0], pNpc->m_ManaMax * pMagic->nValue[0] / 100);
  439. }
  440. void KNpcAttribModify::ManaMaxV(KNpc* pNpc, void* pData)
  441. {
  442. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  443. pNpc->m_CurrentManaMax += pMagic->nValue[0];
  444. g_DebugLog("[数值]%s内力上限增加了%d点", pNpc->Name, pMagic->nValue[0]);
  445. }
  446. void KNpcAttribModify::ManaReplenishV(KNpc* pNpc, void* pData)
  447. {
  448. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  449. pNpc->m_CurrentManaReplenish += pMagic->nValue[0];
  450. g_DebugLog("[数值]%s内力回复速度增加了%d点", pNpc->Name, pMagic->nValue[0]);
  451. }
  452. void KNpcAttribModify::ManaV(KNpc* pNpc, void* pData)
  453. {
  454. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  455. pNpc->m_CurrentMana += pMagic->nValue[0];
  456. g_DebugLog("[数值]%s内力增加了%d点", pNpc->Name, pMagic->nValue[0]);
  457. }
  458. void KNpcAttribModify::ManaShieldP(KNpc* pNpc, void* pData)
  459. {
  460. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  461. if (pMagic->nValue[0] > 0)
  462. {
  463. pNpc->m_ManaShield.nValue[0] = pMagic->nValue[0];
  464. pNpc->m_ManaShield.nTime = pMagic->nValue[1];
  465. g_DebugLog("[数值]%s吸收伤害百分比为%d,持续%d帧", pNpc->Name, pMagic->nValue[0], pMagic->nValue[1]);
  466. }
  467. else
  468. {
  469. pNpc->m_ManaShield.nValue[0] = 0;
  470. pNpc->m_ManaShield.nTime = 0;
  471. g_DebugLog("[数值]吸收伤害效果消失");
  472. }
  473. }
  474. void KNpcAttribModify::MeleeDamageReturnP(KNpc* pNpc, void* pData)
  475. {
  476. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  477. pNpc->m_CurrentMeleeDmgRetPercent += pMagic->nValue[0];
  478. g_DebugLog("[数值]%s近程物理伤害反弹百分比增加%d", pNpc->Name, pMagic->nValue[0]);
  479. }
  480. void KNpcAttribModify::MeleeDamageReturnV(KNpc* pNpc, void* pData)
  481. {
  482. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  483. pNpc->m_CurrentMeleeDmgRet += pMagic->nValue[0];
  484. g_DebugLog("[数值]%s近程物理伤害反弹增加%d", pNpc->Name, pMagic->nValue[0]);
  485. }
  486. void KNpcAttribModify::MetalSkillV(KNpc* pNpc, void* pData)
  487. {
  488. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  489. g_DebugLog("[数值]%s金系技能加%d级, 未完成", pNpc->Name, pMagic->nValue[0]);
  490. }
  491. void KNpcAttribModify::PhysicsArmorV(KNpc* pNpc, void* pData)
  492. {
  493. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  494. if (pMagic->nValue[0] > 0)
  495. {
  496. pNpc->m_PhysicsArmor.nValue[0] = pMagic->nValue[0];
  497. pNpc->m_PhysicsArmor.nTime = pMagic->nValue[1];
  498. g_DebugLog("[数值]%s物理护盾变为%d点持续%d帧", pNpc->Name, pMagic->nValue[0], pMagic->nValue[1]);
  499. }
  500. else
  501. {
  502. pNpc->m_PhysicsArmor.nValue[0] = 0;
  503. pNpc->m_PhysicsArmor.nTime = 0;
  504. g_DebugLog("[数值]%s物理护盾消失", pNpc->Name);
  505. }
  506. }
  507. void KNpcAttribModify::PhysicsresP(KNpc* pNpc, void* pData)
  508. {
  509. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  510. pNpc->m_CurrentPhysicsResist += pMagic->nValue[0];
  511. g_DebugLog("[数值]%s物理抗性增加了%d点", pNpc->Name, pMagic->nValue[0]);
  512. }
  513. void KNpcAttribModify::Damage2ManaP(KNpc* pNpc, void* pData)
  514. {
  515. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  516. pNpc->m_CurrentDamage2Mana += pMagic->nValue[0];
  517. g_DebugLog("[数值]%s伤害转内力百分比增加了%d", pNpc->Name, pMagic->nValue[0]);
  518. }
  519. void KNpcAttribModify::PoisonArmorV(KNpc* pNpc, void* pData)
  520. {
  521. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  522. if (pMagic->nValue[0] > 0)
  523. {
  524. pNpc->m_PoisonArmor.nValue[0] = pMagic->nValue[0];
  525. pNpc->m_PoisonArmor.nTime = pMagic->nValue[1];
  526. g_DebugLog("[数值]%s毒护盾变为%d点持续%d帧", pNpc->Name, pMagic->nValue[0], pMagic->nValue[1]);
  527. }
  528. else
  529. {
  530. pNpc->m_PoisonArmor.nValue[0] = 0;
  531. pNpc->m_PoisonArmor.nTime = 0;
  532. g_DebugLog("[数值]%s毒护盾消失", pNpc->Name);
  533. }
  534. }
  535. void KNpcAttribModify::PoisonDamageReduceV(KNpc* pNpc, void* pData)
  536. {
  537. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  538. pNpc->m_PoisonState.nValue[0] -= pMagic->nValue[0];
  539. if (pNpc->m_PoisonState.nValue[0] <= 0)
  540. {
  541. pNpc->m_PoisonState.nTime = 0;
  542. }
  543. g_DebugLog("[数值]%s中毒伤害减少%d", pNpc->Name, pMagic->nValue[0]);
  544. }
  545. void KNpcAttribModify::PoisonresP(KNpc* pNpc, void* pData)
  546. {
  547. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  548. pNpc->m_CurrentPoisonResist += pMagic->nValue[0];
  549. g_DebugLog("[数值]%s毒抗性增加了%d点", pNpc->Name, pMagic->nValue[0]);
  550. }
  551. void KNpcAttribModify::PoisonTimeReduceP(KNpc* pNpc, void* pData)
  552. {
  553. // 装备里,需要修改TODO
  554. // KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  555. // pNpc->m_PoisonState.nTime *= (100 - pMagic->nValue[0]);
  556. // pNpc->m_PoisonState.nTime /= 100;
  557. // if (pNpc->m_PoisonState.nTime <= 0)
  558. // {
  559. // pNpc->m_PoisonState.nTime = 0;
  560. // }
  561. // g_DebugLog("[数值]%s中毒时间减少百分之%d", pNpc->Name, pMagic->nValue[0]);
  562. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  563. pNpc->m_CurrentPoisonTimeReducePercent += pMagic->nValue[0];
  564. g_DebugLog("[数值]%s中毒时间减少百分之%d", pNpc->Name, pMagic->nValue[0]);
  565. }
  566. void KNpcAttribModify::RangeDamageReturnV(KNpc* pNpc, void* pData)
  567. {
  568. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  569. pNpc->m_CurrentRangeDmgRet += pMagic->nValue[0];
  570. g_DebugLog("[数值]%s远程伤害反弹增加%d", pNpc->Name, pMagic->nValue[0]);
  571. }
  572. void KNpcAttribModify::RangeDamageReturnP(KNpc* pNpc, void* pData)
  573. {
  574. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  575. pNpc->m_CurrentRangeDmgRetPercent += pMagic->nValue[0];
  576. g_DebugLog("[数值]%s远程伤害反弹百分比增加%d", pNpc->Name, pMagic->nValue[0]);
  577. }
  578. void KNpcAttribModify::SlowMissleB(KNpc* pNpc, void* pData)
  579. {
  580. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  581. if (pMagic->nValue[0] > 0)
  582. pNpc->m_CurrentSlowMissle = 1;
  583. else
  584. pNpc->m_CurrentSlowMissle = 0;
  585. g_DebugLog("[数值]%s子弹减速状态变为%d", pNpc->Name, pMagic->nValue[0]);
  586. }
  587. void KNpcAttribModify::StaminaMaxP(KNpc* pNpc, void* pData)
  588. {
  589. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  590. pNpc->m_CurrentStaminaMax += pNpc->m_StaminaMax * pMagic->nValue[0] / 100;
  591. g_DebugLog("[数值]%s体力上限增加了百分之%d(%d点)", pNpc->Name, pMagic->nValue[0], pNpc->m_StaminaMax * pMagic->nValue[0] / 100);
  592. }
  593. void KNpcAttribModify::StaminaMaxV(KNpc* pNpc, void* pData)
  594. {
  595. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  596. pNpc->m_CurrentStaminaMax += pMagic->nValue[0];
  597. g_DebugLog("[数值]%s体力上限增加了%d点", pNpc->Name, pMagic->nValue[0]);
  598. }
  599. void KNpcAttribModify::StaminaReplenishV(KNpc* pNpc, void* pData)
  600. {
  601. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  602. pNpc->m_CurrentStaminaGain += pMagic->nValue[0];
  603. g_DebugLog("[数值]%s体力回复速度增加了%d点", pNpc->Name, pMagic->nValue[0]);
  604. }
  605. void KNpcAttribModify::StaminaV(KNpc* pNpc, void* pData)
  606. {
  607. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  608. pNpc->m_CurrentStamina += pMagic->nValue[0];
  609. g_DebugLog("[数值]%s体力增加了%d点", pNpc->Name, pMagic->nValue[0]);
  610. }
  611. void KNpcAttribModify::StealLifeP(KNpc* pNpc, void* pData)
  612. {
  613. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  614. pNpc->m_CurrentLifeStolen += pMagic->nValue[0];
  615. g_DebugLog("[数值]%s偷生命百分比为%d(比原本上升了%d点)", pNpc->Name, pNpc->m_CurrentLifeStolen, pMagic->nValue[0]);
  616. }
  617. void KNpcAttribModify::StealManaP(KNpc* pNpc, void* pData)
  618. {
  619. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  620. pNpc->m_CurrentManaStolen += pMagic->nValue[0];
  621. g_DebugLog("[数值]%s偷内力百分比为%d(比原本上升了%d点)", pNpc->Name, pNpc->m_CurrentManaStolen, pMagic->nValue[0]);
  622. }
  623. void KNpcAttribModify::StealStaminaP(KNpc* pNpc, void* pData)
  624. {
  625. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  626. pNpc->m_CurrentStaminaStolen += pMagic->nValue[0];
  627. g_DebugLog("[数值]%s偷体力百分比为%d(比原本上升了%d点)", pNpc->Name, pNpc->m_CurrentStaminaStolen, pMagic->nValue[0]);
  628. }
  629. void KNpcAttribModify::StrengthV(KNpc* pNpc, void* pData)
  630. {
  631. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  632. if (pNpc->m_Kind != kind_player)
  633. return;
  634. if (pNpc->m_nPlayerIdx <= 0)
  635. return;
  636. Player[pNpc->m_nPlayerIdx].ChangeCurStrength(pMagic->nValue[0]);
  637. g_DebugLog("[数值]%s当前力量增加了%d点", pNpc->Name, pMagic->nValue[0]);
  638. }
  639. void KNpcAttribModify::StunTimeReduceP(KNpc* pNpc, void* pData)
  640. {
  641. // 装备,需要修改TODO
  642. // KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  643. // pNpc->m_StunState.nTime -= pMagic->nValue[0];
  644. // if (pNpc->m_StunState.nTime <= 0)
  645. // {
  646. // pNpc->m_StunState.nTime = 0;
  647. // }
  648. // g_DebugLog("[数值]%s眩晕时间减少%d", pNpc->Name, pMagic->nValue[0]);
  649. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  650. pNpc->m_CurrentStunTimeReducePercent += pMagic->nValue[0];
  651. g_DebugLog("[数值]%s眩晕时间减少%d", pNpc->Name, pMagic->nValue[0]);
  652. }
  653. void KNpcAttribModify::VisionRadiusP(KNpc* pNpc, void* pData)
  654. {
  655. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  656. pNpc->m_CurrentVisionRadius += pMagic->nValue[0];
  657. g_DebugLog("[数值]%s视野范围增加%d", pNpc->Name, pMagic->nValue[0]);
  658. }
  659. void KNpcAttribModify::VitalityV(KNpc* pNpc, void* pData)
  660. {
  661. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  662. if (pNpc->m_Kind != kind_player)
  663. return;
  664. if (pNpc->m_nPlayerIdx <= 0)
  665. return;
  666. Player[pNpc->m_nPlayerIdx].ChangeCurVitality(pMagic->nValue[0]);
  667. g_DebugLog("[数值]%s当前活力增加了%d点", pNpc->Name, pMagic->nValue[0]);
  668. }
  669. void KNpcAttribModify::WaterSkillV(KNpc* pNpc, void* pData)
  670. {
  671. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  672. g_DebugLog("[数值]%s水系技能加%d级,未完成", pNpc->Name, pMagic->nValue[0]);
  673. }
  674. void KNpcAttribModify::WoodSkillV(KNpc* pNpc, void* pData)
  675. {
  676. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  677. g_DebugLog("[数值]%s木系技能加%d级,未完成", pNpc->Name, pMagic->nValue[0]);
  678. }
  679. void KNpcAttribModify::FireresP(KNpc* pNpc, void* pData)
  680. {
  681. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  682. pNpc->m_CurrentFireResist += pMagic->nValue[0];
  683. g_DebugLog("[数值]%s火抗性增加了%d点", pNpc->Name, pMagic->nValue[0]);
  684. }
  685. void KNpcAttribModify::ArmorDefenseV(KNpc* pNpc, void* pData)
  686. {
  687. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  688. pNpc->m_CurrentDefend += pMagic->nValue[0];
  689. g_DebugLog("[数值]%s防御增加了%d点", pNpc->Name, pMagic->nValue[0]);
  690. }
  691. void KNpcAttribModify::ColdEnhanceP(KNpc* pNpc, void* pData)
  692. {
  693. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  694. pNpc->m_CurrentColdEnhance += pMagic->nValue[0];
  695. g_DebugLog("[数值]%s冰增强增加了%d点", pNpc->Name, pMagic->nValue[0]);
  696. }
  697. void KNpcAttribModify::FireEnhanceP(KNpc* pNpc, void* pData)
  698. {
  699. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  700. pNpc->m_CurrentFireEnhance += pMagic->nValue[0];
  701. g_DebugLog("[数值]%s火增强增加了%d点", pNpc->Name, pMagic->nValue[0]);
  702. }
  703. void KNpcAttribModify::LightingEnhanceP(KNpc* pNpc, void* pData)
  704. {
  705. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  706. pNpc->m_CurrentLightEnhance += pMagic->nValue[0];
  707. g_DebugLog("[数值]%s电增强增加了%d点", pNpc->Name, pMagic->nValue[0]);
  708. }
  709. void KNpcAttribModify::PoisonEnhanceP(KNpc* pNpc, void* pData)
  710. {
  711. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  712. pNpc->m_CurrentPoisonEnhance += pMagic->nValue[0];
  713. g_DebugLog("[数值]%s毒增强增加了%d点", pNpc->Name, pMagic->nValue[0]);
  714. }
  715. void KNpcAttribModify::LifePotionV(KNpc* pNpc, void* pData)
  716. {
  717. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  718. if (pMagic->nValue[1] <= 0)
  719. return;
  720. int nX1, nY1, nX2, nY2;
  721. nX1 = pNpc->m_LifeState.nValue[0];
  722. nY1 = pNpc->m_LifeState.nTime;
  723. nX2 = pMagic->nValue[0];
  724. nY2 = pMagic->nValue[1];
  725. pNpc->m_LifeState.nTime = max(nY1, nY2);
  726. // 传入参数保证时间大于零,所以最大值一定大于零,所以不用判断除零
  727. pNpc->m_LifeState.nValue[0] = (nX1 * nY1 + nX2 * nY2) / pNpc->m_LifeState.nTime;
  728. g_DebugLog("[数值]%s喝了补血药,获得%d帧内每10帧回复%d点生命的效果", pNpc->Name,
  729. pNpc->m_LifeState.nTime, 
  730. pNpc->m_LifeState.nValue[0]);
  731. }
  732. void KNpcAttribModify::ManaPotionV(KNpc* pNpc, void* pData)
  733. {
  734. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  735. if (pMagic->nValue[1] <= 0)
  736. return;
  737. int nX1, nY1, nX2, nY2;
  738. nX1 = pNpc->m_ManaState.nValue[0];
  739. nY1 = pNpc->m_ManaState.nTime;
  740. nX2 = pMagic->nValue[0];
  741. nY2 = pMagic->nValue[1];
  742. pNpc->m_ManaState.nTime = max(nY1, nY2);
  743. // 传入参数保证时间大于零,所以最大值一定大于零,所以不用判断除零
  744. pNpc->m_ManaState.nValue[0] = (nX1 * nY1 + nX2 * nY2) / pNpc->m_ManaState.nTime;
  745. g_DebugLog("[数值]%s喝了补内力药,获得%d帧内每10帧回复%d点内力的效果", pNpc->Name,
  746. pNpc->m_ManaState.nTime, 
  747. pNpc->m_ManaState.nValue[0]);
  748. }
  749. void KNpcAttribModify::PhysicsResMaxP(KNpc* pNpc, void* pData)
  750. {
  751. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  752. pNpc->m_CurrentPhysicsResistMax += pMagic->nValue[0];
  753. g_DebugLog("[数值]%s物理抗性上限增加了%d点", pNpc->Name, pMagic->nValue[0]);
  754. }
  755. void KNpcAttribModify::ColdResMaxP(KNpc* pNpc, void* pData)
  756. {
  757. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  758. pNpc->m_CurrentColdResistMax += pMagic->nValue[0];
  759. g_DebugLog("[数值]%s冰抗性上限增加了%d点", pNpc->Name, pMagic->nValue[0]);
  760. }
  761. void KNpcAttribModify::FireResMaxP(KNpc* pNpc, void* pData)
  762. {
  763. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  764. pNpc->m_CurrentFireResistMax += pMagic->nValue[0];
  765. g_DebugLog("[数值]%s火抗性上限增加了%d点", pNpc->Name, pMagic->nValue[0]);
  766. }
  767. void KNpcAttribModify::LightingResMaxP(KNpc* pNpc, void* pData)
  768. {
  769. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  770. pNpc->m_CurrentLightResistMax += pMagic->nValue[0];
  771. g_DebugLog("[数值]%s电抗性上限增加了%d点", pNpc->Name, pMagic->nValue[0]);
  772. }
  773. void KNpcAttribModify::PoisonResMaxP(KNpc* pNpc, void* pData)
  774. {
  775. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  776. pNpc->m_CurrentPoisonResistMax += pMagic->nValue[0];
  777. g_DebugLog("[数值]%s毒抗性上限增加了%d点", pNpc->Name, pMagic->nValue[0]);
  778. }
  779. void KNpcAttribModify::AllResMaxP(KNpc* pNpc, void* pData)
  780. {
  781. KMagicAttrib* pMagic = (KMagicAttrib *)pData;
  782. pNpc->m_CurrentFireResistMax += pMagic->nValue[0];
  783. pNpc->m_CurrentColdResistMax += pMagic->nValue[0];
  784. pNpc->m_CurrentLightResistMax += pMagic->nValue[0];
  785. pNpc->m_CurrentPoisonResistMax += pMagic->nValue[0];
  786. pNpc->m_CurrentPhysicsResistMax += pMagic->nValue[0];
  787. g_DebugLog("[数值]%s五防抗性上限增加%d", pNpc->Name, pMagic->nValue[0]);
  788. }
  789. void KNpcAttribModify::FatallyStrikeP(KNpc* pNpc, void* pData)
  790. {
  791. }
  792. void KNpcAttribModify::MixPoisonDamage(KMagicAttrib* pDes, KMagicAttrib* pSrc)
  793. {
  794. int d1, d2, t1, t2, c1, c2;
  795. d1 = pDes->nValue[0];
  796. d2 = pSrc->nValue[0];
  797. t1 = pDes->nValue[1];
  798. t2 = pSrc->nValue[1];
  799. c1 = pDes->nValue[2];
  800. c2 = pSrc->nValue[2];
  801. if (c1 == 0 || d1 == 0)
  802. {
  803. memcpy(pDes, pSrc, sizeof(KMagicAttrib));
  804. return;
  805. }
  806. if (c2 == 0 || d2 == 0)
  807. {
  808. return;
  809. }
  810. pDes->nValue[0] = ((c1 + c2) * d1 / c1 + (c1 + c2) * d2 / c2) / 2;
  811. pDes->nValue[1] = (t1 * d1 * c2 + t2 *d2 * c1) /(d1 * c2 + d2 * c1);
  812. pDes->nValue[2] = (c1 + c2) / 2;
  813. }