2 * @brief 青魔法の処理実装 / Blue magic
5 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
9 * 2014 Deskull rearranged comment for Doxygen.
12 #include "blue-magic/blue-magic-checker.h"
13 #include "core/player-redraw-types.h"
14 #include "main/sound-definitions-table.h"
15 #include "main/sound-of-music.h"
16 #include "mind/mind-blue-mage.h"
17 #include "monster-race/race-ability-mask.h"
18 #include "mspell/monster-power-table.h"
19 #include "player/attack-defense-types.h"
20 #include "status/experience.h"
21 #include "view/display-messages.h"
24 * @brief 青魔法のラーニング判定と成功した場合のラーニング処理
25 * @param monspell ラーニングを試みるモンスター攻撃のID
28 void learn_spell(player_type *learner_ptr, int monspell)
30 if (learner_ptr->action != ACTION_LEARN)
34 if (learner_ptr->magic_num2[monspell])
36 if (learner_ptr->confused || learner_ptr->blind || learner_ptr->image || learner_ptr->stun || learner_ptr->paralyzed)
38 if (randint1(learner_ptr->lev + 70) > monster_powers[monspell].level + 40) {
39 learner_ptr->magic_num2[monspell] = 1;
40 msg_format(_("%sを学習した!", "You have learned %s!"), monster_powers[monspell].name);
41 gain_exp(learner_ptr, monster_powers[monspell].level * monster_powers[monspell].smana);
43 learner_ptr->new_mane = TRUE;
44 learner_ptr->redraw |= PR_STATE;
49 * @brief モンスター特殊能力のフラグ配列から特定条件の魔法だけを抜き出す処理
50 * Extract monster spells mask for the given mode
51 * @param f4 モンスター特殊能力の4番目のフラグ配列
52 * @param f5 モンスター特殊能力の5番目のフラグ配列
53 * @param f6 モンスター特殊能力の6番目のフラグ配列
54 * @param mode 抜き出したい条件
56 * @todo f4, f5, f6を構造体にまとめ直す
58 void set_rf_masks(FlagGroup<RF_ABILITY>& ability_flags, blue_magic_type mode)
60 ability_flags.clear();
63 case MONSPELL_TYPE_BOLT:
64 ability_flags.set(RF_ABILITY_BOLT_MASK | RF_ABILITY_BEAM_MASK).reset(RF_ABILITY::ROCKET);
67 case MONSPELL_TYPE_BALL:
68 ability_flags.set(RF_ABILITY_BALL_MASK).reset(RF_ABILITY_BREATH_MASK);
71 case MONSPELL_TYPE_BREATH:
72 ability_flags.set(RF_ABILITY_BREATH_MASK);
75 case MONSPELL_TYPE_SUMMON:
76 ability_flags.set(RF_ABILITY_SUMMON_MASK);
79 case MONSPELL_TYPE_OTHER:
80 ability_flags.set(RF_ABILITY_ATTACK_MASK);
81 ability_flags.reset(RF_ABILITY_BOLT_MASK | RF_ABILITY_BEAM_MASK | RF_ABILITY_BALL_MASK | RF_ABILITY_INDIRECT_MASK);