-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3342 from sikabane-works/merge/heng#2404
変愚「WeaponEnchanter を武器種別ごとに分離した #2404」のマージ
- Loading branch information
Showing
13 changed files
with
398 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*! | ||
* @brief 矢類のアイテムを強化する処理 | ||
* @date 2022/03/11 | ||
* @author Hourier | ||
*/ | ||
|
||
#include "object-enchant/weapon/apply-magic-arrow.h" | ||
#include "artifact/random-art-generator.h" | ||
#include "floor/floor-base-definitions.h" | ||
#include "inventory/inventory-slot-types.h" | ||
#include "system/object-type-definition.h" | ||
#include "system/player-type-definition.h" | ||
|
||
/*! | ||
* @brief 矢類強化クラスのコンストラクタ | ||
* @param player_ptr プレイヤーへの参照ポインタ | ||
* @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ | ||
* @param level 生成基準階 | ||
* @param power 生成ランク | ||
*/ | ||
ArrowEnchanter::ArrowEnchanter(PlayerType *player_ptr, ObjectType *o_ptr, DEPTH level, int power) | ||
: AbstractWeaponEnchanter(o_ptr, level, power) | ||
, player_ptr(player_ptr) | ||
{ | ||
} | ||
|
||
/*! | ||
* @brief 矢類に生成ランクごとの強化を与えるサブルーチン | ||
* @details power > 2はデバッグ専用. | ||
*/ | ||
void ArrowEnchanter::apply_magic() | ||
{ | ||
if (this->should_skip) { | ||
return; | ||
} | ||
|
||
if (this->power > 1) { | ||
if (this->power > 2) { | ||
become_random_artifact(this->player_ptr, this->o_ptr, false); | ||
return; | ||
} | ||
|
||
this->o_ptr->ego_idx = get_random_ego(INVEN_AMMO, true); | ||
while (one_in_(10 * this->o_ptr->dd * this->o_ptr->ds)) { | ||
this->o_ptr->dd++; | ||
} | ||
|
||
if (this->o_ptr->dd > 9) { | ||
this->o_ptr->dd = 9; | ||
} | ||
|
||
return; | ||
} | ||
|
||
if (this->power < -1) { | ||
if (randint0(MAX_DEPTH) < this->level) { | ||
this->o_ptr->ego_idx = get_random_ego(INVEN_AMMO, false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*! | ||
* @brief 弓系のアイテムを強化する処理 | ||
* @date 2022/03/11 | ||
* @author Hourier | ||
*/ | ||
|
||
#include "object-enchant/weapon/apply-magic-bow.h" | ||
#include "artifact/random-art-generator.h" | ||
#include "inventory/inventory-slot-types.h" | ||
#include "system/object-type-definition.h" | ||
|
||
/*! | ||
* @brief 弓強化クラスのコンストラクタ | ||
* @param player_ptr プレイヤーへの参照ポインタ | ||
* @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ | ||
* @param level 生成基準階 | ||
* @param power 生成ランク | ||
*/ | ||
BowEnchanter::BowEnchanter(PlayerType *player_ptr, ObjectType *o_ptr, DEPTH level, int power) | ||
: AbstractWeaponEnchanter(o_ptr, level, power) | ||
, player_ptr(player_ptr) | ||
{ | ||
} | ||
|
||
/*! | ||
* @brief 弓系オブジェクトに生成ランクごとの強化を与えるサブルーチン | ||
* Apply magic to an item known to be a "weapon" | ||
* @details power > 2はデバッグ専用. | ||
*/ | ||
void BowEnchanter::apply_magic() | ||
{ | ||
if (this->should_skip) { | ||
return; | ||
} | ||
|
||
if (this->power > 1) { | ||
if ((this->power > 2) || one_in_(20)) { | ||
become_random_artifact(this->player_ptr, this->o_ptr, false); | ||
return; | ||
} | ||
|
||
this->o_ptr->ego_idx = get_random_ego(INVEN_BOW, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include "object-enchant/weapon/abstract-weapon-enchanter.h" | ||
#include "system/angband.h" | ||
|
||
class ObjectType; | ||
class PlayerType; | ||
class BowEnchanter : AbstractWeaponEnchanter { | ||
public: | ||
BowEnchanter(PlayerType *player_ptr, ObjectType *o_ptr, DEPTH level, int power); | ||
void apply_magic() override; | ||
|
||
protected: | ||
void sval_enchant() override{}; | ||
void give_ego_index() override{}; | ||
void give_high_ego_index() override{}; | ||
void give_cursed() override{}; | ||
|
||
private: | ||
PlayerType *player_ptr; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*! | ||
* @brief 掘削武器に耐性等の追加効果を付与する処理 | ||
* @date 2022/03/11 | ||
* @author Hourier | ||
*/ | ||
|
||
#include "object-enchant/weapon/apply-magic-digging.h" | ||
#include "artifact/random-art-generator.h" | ||
#include "system/object-type-definition.h" | ||
#include "system/player-type-definition.h" | ||
|
||
/*! | ||
* @brief 掘削武器強化クラスのコンストラクタ | ||
* @param player_ptr プレイヤーへの参照ポインタ | ||
* @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ | ||
* @param level 生成基準階 | ||
* @param power 生成ランク | ||
*/ | ||
DiggingEnchanter::DiggingEnchanter(PlayerType *player_ptr, ObjectType *o_ptr, DEPTH level, int power) | ||
: AbstractWeaponEnchanter(o_ptr, level, power) | ||
, player_ptr(player_ptr) | ||
{ | ||
} | ||
|
||
/*! | ||
* @brief 掘削武器に生成ランクごとの強化を与えるサブルーチン | ||
* @details power > 2はデバッグ専用. | ||
*/ | ||
void DiggingEnchanter::apply_magic() | ||
{ | ||
if (this->should_skip) { | ||
return; | ||
} | ||
|
||
if (this->power > 1) { | ||
if ((this->power > 2) || one_in_(30)) { | ||
become_random_artifact(this->player_ptr, this->o_ptr, false); | ||
} else { | ||
this->o_ptr->ego_idx = EgoType::DIGGING; | ||
} | ||
|
||
return; | ||
} | ||
|
||
if (this->power < -1) { | ||
this->o_ptr->pval = 0 - (5 + randint1(5)); | ||
return; | ||
} | ||
|
||
if (this->power < 0) { | ||
this->o_ptr->pval = 0 - (this->o_ptr->pval); | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include "object-enchant/weapon/abstract-weapon-enchanter.h" | ||
#include "system/angband.h" | ||
|
||
class ObjectType; | ||
class PlayerType; | ||
class DiggingEnchanter : AbstractWeaponEnchanter { | ||
public: | ||
DiggingEnchanter(PlayerType *player_ptr, ObjectType *o_ptr, DEPTH level, int power); | ||
void apply_magic() override; | ||
|
||
protected: | ||
void sval_enchant() override{}; | ||
void give_ego_index() override{}; | ||
void give_high_ego_index() override{}; | ||
void give_cursed() override{}; | ||
|
||
private: | ||
PlayerType *player_ptr; | ||
}; |
Oops, something went wrong.