MCPcopy Create free account
hub / github.com/Cirrus-Minor/witchblast / triggerDivinityBefore

Method triggerDivinityBefore

src/PlayerEntity.cpp:3119–3218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3117}
3118
3119bool PlayerEntity::triggerDivinityBefore()
3120{
3121 if (divinity.divinity > -1 && divinity.interventions < divinity.level - 1)
3122 {
3123 switch (divinity.divinity)
3124 {
3125 case DivinityHealer:
3126 {
3127 if (game().getUndeadCount() > 0 && rand() % 2 == 0)
3128 {
3129 SoundManager::getInstance().playSound(SOUND_OM);
3130 incrementDivInterventions();
3131 divineHeal(hpMax / 2);
3132 divineDestroyUndead();
3133 game().makeColorEffect(X_GAME_COLOR_WHITE, 0.45f);
3134 return true;
3135 }
3136 break;
3137 }
3138 case DivinityFighter:
3139 {
3140 int r = rand() % 3;
3141 if (r == 0) return false;
3142
3143 SoundManager::getInstance().playSound(SOUND_OM);
3144 incrementDivInterventions();
3145 divineHeal(hpMax / 3);
3146 if (r == 1) divineProtection(8.0f, 0.8f);
3147 else divineFury();
3148 game().makeColorEffect(X_GAME_COLOR_RED, 0.45f);
3149 return true;
3150 break;
3151 }
3152 case DivinityIce:
3153 {
3154 int r = rand() % 3;
3155 if (r == 0) return false;
3156
3157 SoundManager::getInstance().playSound(SOUND_OM);
3158 incrementDivInterventions();
3159 divineHeal(hpMax / 3);
3160 if (r == 1)
3161 {
3162 divineIce();
3163 game().makeColorEffect(X_GAME_COLOR_BLUE, 7.5f);
3164 }
3165 else
3166 {
3167 divineFury();
3168 game().makeColorEffect(X_GAME_COLOR_BLUE, 0.5f);
3169 }
3170 return true;
3171 break;
3172 }
3173 case DivinityStone:
3174 {
3175 int r = rand() % 2;
3176 divineProtection(10.0f, 0.75f);

Callers

nothing calls this directly

Calls 3

getUndeadCountMethod · 0.80
playSoundMethod · 0.80
makeColorEffectMethod · 0.80

Tested by

no test coverage detected