1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
158 | sp *= (int) PATH_SP_MULT (caster, spell); |
158 | sp *= (int) PATH_SP_MULT (caster, spell); |
159 | if (!sp && spell->stats.sp) |
159 | if (!sp && spell->stats.sp) |
160 | sp = 1; |
160 | sp = 1; |
161 | |
161 | |
162 | if (spell->stats.grace && spell->stats.maxgrace) |
162 | if (spell->stats.grace && spell->stats.maxgrace) |
163 | grace = spell->stats.grace * (1.0 + max (0, float (level - spell->level) / spell->stats.maxgrace)); |
163 | grace = spell->stats.grace * (1.f + max (0.f, float (level - spell->level) / spell->stats.maxgrace)); |
164 | else |
164 | else |
165 | grace = spell->stats.grace; |
165 | grace = spell->stats.grace; |
166 | |
166 | |
167 | grace *= PATH_SP_MULT (caster, spell); |
167 | grace *= PATH_SP_MULT (caster, spell); |
168 | if (spell->stats.grace && !grace) |
168 | if (spell->stats.grace && !grace) |
… | |
… | |
404 | if (OB_TYPE_MOVE_BLOCK (op, ms.move_block)) |
404 | if (OB_TYPE_MOVE_BLOCK (op, ms.move_block)) |
405 | return 0; |
405 | return 0; |
406 | |
406 | |
407 | int max_effects = 5; // max. number of similar spells per mapspace |
407 | int max_effects = 5; // max. number of similar spells per mapspace |
408 | |
408 | |
409 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
409 | for (object *tmp = ms.top; tmp; tmp = tmp->below) |
410 | { |
410 | { |
411 | /* If there is a counterspell on the space, and this |
411 | /* If there is a counterspell on the space, and this |
412 | * object is using magic, don't progress. I believe we could |
412 | * object is using magic, don't progress. I believe we could |
413 | * leave this out and let in progress, and other areas of the code |
413 | * leave this out and let in progress, and other areas of the code |
414 | * will then remove it, but that would seem to to use more |
414 | * will then remove it, but that would seem to to use more |
… | |
… | |
795 | godname = "Your spirit"; |
795 | godname = "Your spirit"; |
796 | |
796 | |
797 | if (failure <= -20 && failure > -40) /* wonder */ |
797 | if (failure <= -20 && failure > -40) /* wonder */ |
798 | { |
798 | { |
799 | op->failmsgf ("%s gives a sign to renew your faith." HINT_GRACE, godname); |
799 | op->failmsgf ("%s gives a sign to renew your faith." HINT_GRACE, godname); |
800 | tmp = get_archetype (SPELL_WONDER); |
800 | tmp = archetype::get (SPELL_WONDER); |
801 | cast_cone (op, op, 0, tmp); |
801 | cast_cone (op, op, 0, tmp); |
802 | tmp->destroy (); |
802 | tmp->destroy (); |
803 | } |
803 | } |
804 | |
804 | |
805 | else if (failure <= -40 && failure > -60) /* confusion */ |
805 | else if (failure <= -40 && failure > -60) /* confusion */ |
… | |
… | |
814 | godname); |
814 | godname); |
815 | paralyze_player (op, op, 99); |
815 | paralyze_player (op, op, 99); |
816 | } |
816 | } |
817 | else if (failure <= -150) /* blast the immediate area */ |
817 | else if (failure <= -150) /* blast the immediate area */ |
818 | { |
818 | { |
819 | tmp = get_archetype (GOD_POWER); |
819 | tmp = archetype::get (GOD_POWER); |
820 | op->failmsgf ("%s smites you!" HINT_GRACE, godname); |
820 | op->failmsgf ("%s smites you!" HINT_GRACE, godname); |
821 | cast_magic_storm (op, tmp, power); |
821 | cast_magic_storm (op, tmp, power); |
822 | } |
822 | } |
823 | } |
823 | } |
824 | |
824 | |
… | |
… | |
840 | return; |
840 | return; |
841 | |
841 | |
842 | if (failure <= -20 && failure > -40) /* wonder */ |
842 | if (failure <= -20 && failure > -40) /* wonder */ |
843 | { |
843 | { |
844 | op->failmsg ("Your spell causes an unexpected effect."); |
844 | op->failmsg ("Your spell causes an unexpected effect."); |
845 | tmp = get_archetype (SPELL_WONDER); |
845 | tmp = archetype::get (SPELL_WONDER); |
846 | cast_cone (op, op, 0, tmp); |
846 | cast_cone (op, op, 0, tmp); |
847 | tmp->destroy (); |
847 | tmp->destroy (); |
848 | } |
848 | } |
849 | |
849 | |
850 | else if (failure <= -40 && failure > -60) /* confusion */ |
850 | else if (failure <= -40 && failure > -60) /* confusion */ |
… | |
… | |
869 | |
869 | |
870 | } |
870 | } |
871 | else |
871 | else |
872 | { |
872 | { |
873 | op->failmsg ("You lose control of the mana! The uncontrolled magic blasts you!"); |
873 | op->failmsg ("You lose control of the mana! The uncontrolled magic blasts you!"); |
874 | tmp = get_archetype (LOOSE_MANA); |
874 | tmp = archetype::get (LOOSE_MANA); |
875 | tmp->level = skill->level; |
875 | tmp->level = skill->level; |
876 | |
876 | |
877 | /* increase the area of destruction a little for more powerful spells */ |
877 | /* increase the area of destruction a little for more powerful spells */ |
878 | tmp->range += isqrt (power); |
878 | tmp->range += isqrt (power); |
879 | |
879 | |
… | |
… | |
1504 | * the victim with a specific maximum level. |
1504 | * the victim with a specific maximum level. |
1505 | */ |
1505 | */ |
1506 | void |
1506 | void |
1507 | create_exploding_ball_at (object *victim, int level) |
1507 | create_exploding_ball_at (object *victim, int level) |
1508 | { |
1508 | { |
1509 | object *ball = get_archetype (EXPLODING_FIREBALL); |
1509 | object *ball = archetype::get (EXPLODING_FIREBALL); |
1510 | ball->dam_modifier = random_roll (1, level, victim, PREFER_LOW) / 5 + 1; |
1510 | ball->dam_modifier = random_roll (1, level, victim, PREFER_LOW) / 5 + 1; |
1511 | ball->stats.maxhp = random_roll (1, level, victim, PREFER_LOW) / 10 + 2; |
1511 | ball->stats.maxhp = random_roll (1, level, victim, PREFER_LOW) / 10 + 2; |
1512 | ball->insert_at (victim); |
1512 | ball->insert_at (victim); |
1513 | } |
1513 | } |