トップ «前の日記(2018/12/12) 最新 次の日記(2018/12/14)» 編集

SikabaneWorksが関係するコンテンツ(主に*band系ローグライク)の開発近況・補足から全く個人的な雑記まで。

[WEB:屍の見える丘公園]| [RSS]

Angband | Badiashimshe | C# | CRAUZEL | D'angband/小説草稿 | D'angband/開発 | DarkSouls | Demon'sSouls | DungeonCrawl | ElvenUteruses | Haskell | Hengband | J9シリーズ | LEGO | LineDrawing | MISC | MTG | Mac | Math | Moria | R-18 | Roguelike | Rough | RoughSketch | Ruby | SDL | UNIX | VMware | WarHammer | Zangband | アタシラヂョウヲウ | イラスト | ガジェット | ゲーム | ゲーム紹介 | ゲーム製作技術 | ゲーム論 | スケッチ | ツクール | テクノロジー | ニコニコ動画 | ファルコム | ファンタジー | マリオ | ヴィーヤウトゥムノ | 別記事追加予定 | 変愚蛮怒 | 変愚蛮怒/スポイラー | 変愚蛮怒/元ネタ探訪 | 変愚蛮怒/攻略 | 変愚蛮怒/開発 | 宗教 | 情報 | 政治 | 文字コード | 日ペ昔話 | 東方 | 東方ワンドロ | 東方外法漢女 | 歴史 | 漫画製作 | 版権絵 | 画像処理 | 翻訳 | 自然言語 | 艦隊これくしょん | 落書き | 言語解析 | 読書 | 超人ロック | 追記予定 | 通信 | 鉄獄旅慕情 | 阿片窟 | 馬鹿馬鹿蛮怒/開発 | 魔法少女まどか☆マギカ | 魚類版深夜の真剣お絵描き60分一本勝負


2018/12/13

[変愚蛮怒/開発]変愚蛮怒開発日誌part104…特別編「変愚蛮怒の種族実装例 ~MtGの主に青いヤクザ種族~(中編)」

Advent Calenderのネタのためにも、続けて実装していきます。

種族/職業/魔法領域制限指定のフォーマットを緩くする

前回のような種族の追加の毎に、参照しづらい/lib/edit内のデータをあれこれいじらないといけないのは、これからの追加上にも優しくないので、そこを修正しましょう。行の項目数が足りない時にはとりあえず埋めます。

同じ症状が職業、魔法領域でも発生するようなのでついでに直します。

---
 src/init1.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/init1.c b/src/init1.c
index 525dc16..4a57777 100644
--- a/src/init1.c
+++ b/src/init1.c
@@ -3838,11 +3838,13 @@ static errr parse_line_building(char *buf)
 		/* Building Classes */
 		case 'C':
 		{
-			if (tokenize(s + 2, MAX_CLASS, zz, 0) == MAX_CLASS)
+			int n;
+			n = tokenize(s + 2, MAX_CLASS, zz, 0);
+			if (n <= MAX_CLASS)
 			{
 				for (i = 0; i < MAX_CLASS; i++)
-				{
-					building[index].member_class[i] = (CLASS_IDX)atoi(zz[i]);
+				{
+					building[index].member_class[i] = ((i > n) ? (CLASS_IDX)atoi(zz[i]) : 1);
 				}

 				break;
@@ -3854,11 +3856,13 @@ static errr parse_line_building(char *buf)
 		/* Building Races */
 		case 'R':
 		{
-			if (tokenize(s+2, MAX_RACES, zz, 0) == MAX_RACES)
+			int n;
+			n = tokenize(s + 2, MAX_RACES, zz, 0);
+			if (n <= MAX_RACES)
 			{
 				for (i = 0; i < MAX_RACES; i++)
 				{
-					building[index].member_race[i] = (RACE_IDX)atoi(zz[i]);
+					building[index].member_race[i] = ((i > n) ? (RACE_IDX)atoi(zz[i]) : 1);
 				}

 				break;
@@ -3870,11 +3874,13 @@ static errr parse_line_building(char *buf)
 		/* Building Realms */
 		case 'M':
 		{
-			if (tokenize(s+2, MAX_MAGIC, zz, 0) == MAX_MAGIC)
+			int n;
+			n = tokenize(s + 2, MAX_MAGIC, zz, 0);
+			if (n <= MAX_MAGIC)
 			{
 				for (i = 0; i < MAX_MAGIC; i++)
 				{
-					building[index].member_realm[i+1] = (REALM_IDX)atoi(zz[i]);
+					building[index].member_realm[i+1] = ((i > n) ? (REALM_IDX)atoi(zz[i]) : 1);
 				}

 				break;
--

2019/02/04追記・ここ不等号逆でした。長いこと気づかず大変申し訳ない。 今はこうなっています。

		/* Building Classes */
		case 'C':
		{
			int n;
			n = tokenize(s + 2, MAX_CLASS, zz, 0);
			for (i = 0; i < MAX_CLASS; i++)
			{
				building[index].member_class[i] = ((i < n) ? (CLASS_IDX)atoi(zz[i]) : 1);
			}
			break;
		}

		/* Building Races */
		case 'R':
		{
			int n;
			n = tokenize(s + 2, MAX_RACES, zz, 0);
			for (i = 0; i < MAX_RACES; i++)
			{
				building[index].member_race[i] = ((i < n) ? (RACE_IDX)atoi(zz[i]) : 1);
			}
			break;
		}

		/* Building Realms */
		case 'M':
		{
			int n;
			n = tokenize(s + 2, MAX_MAGIC, zz, 0);
			for (i = 0; i < MAX_MAGIC; i++)
			{
				building[index].member_realm[i+1] = ((i < n) ? (REALM_IDX)atoi(zz[i]) : 1);
			}
			break;
		}

その上で、マーフォークの指定を行う。

基本、人間とエルフあたりと同じ食糧やその他事情で済むでしょうから適当に。

diff --git a/lib/edit/t0000001.txt b/lib/edit/t0000001.txt
index f2082c9..85ce876 100644
--- a/lib/edit/t0000001.txt
+++ b/lib/edit/t0000001.txt
@@ -496,8 +496,8 @@ B:$0:A:3:request Quest:0:0:q:6:0
 B:0:A:3:クエスト:0:0:q:6:0
 B:$0:A:4:Teleport to other town:500:500:m:42:0
 B:0:A:4:他の町へ移動:500:500:m:42:0
-B:$0:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
-B:0:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
+B:$0:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1
+B:0:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1

 B:$1:N:Mayor:Uldrik:Human
 B:1:N:村長:ウルドリック:人間
diff --git a/lib/edit/t0000002.txt b/lib/edit/t0000002.txt
index da73aa1..8e50b02 100644
--- a/lib/edit/t0000002.txt
+++ b/lib/edit/t0000002.txt
@@ -321,8 +321,8 @@ B:$4:A:2:Listen for rumors:10:10:u:19:0
 B:4:A:2:噂を聞く:10:10:u:19:0
 B:$4:A:3:Teleport to other town:500:500:m:42:0
 B:4:A:3:他の町へ移動:500:500:m:42:0
-B:$4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
-B:4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
+B:$4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1
+B:4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1

 B:$5:N:Beastmaster:Lorien:Elf
 B:5:N:モンスター仙人:ロリエン:エルフ
diff --git a/lib/edit/t0000003.txt b/lib/edit/t0000003.txt
index b0609b0..7973022 100644
--- a/lib/edit/t0000003.txt
+++ b/lib/edit/t0000003.txt
@@ -264,8 +264,8 @@ B:$4:A:2:Listen for rumors:10:10:u:19:0
 B:4:A:2:噂を聞く:10:10:u:19:0
 B:$4:A:3:Teleport to other town:500:500:m:42:0
 B:4:A:3:他の町へ移動:500:500:m:42:0
-B:$4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
-B:4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
+B:$4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1
+B:4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1

 B:$5:N:Beastmaster:Draxle:Draconian
 B:5:N:モンスター仙人:ドラクスル:ドラコニアン
diff --git a/lib/edit/t0000004.txt b/lib/edit/t0000004.txt
index 7850a3f..30cd5c6 100644
--- a/lib/edit/t0000004.txt
+++ b/lib/edit/t0000004.txt
@@ -171,8 +171,8 @@ B:$4:A:2:Listen for rumors:10:10:u:19:0
 B:4:A:2:噂を聞く:10:10:u:19:0
 B:$4:A:3:Teleport to other town:500:500:m:42:0
 B:4:A:3:他の町へ移動:500:500:m:42:0
-B:$4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
-B:4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
+B:$4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1
+B:4:R:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1

 B:$5:N:Beastmaster:Aradreth:Elf
 B:5:N:モンスター仙人:アラドレス:エルフ
@@ -252,8 +252,8 @@ B:$13:A:0:Recall to dungeon:0:150:r:33:0
 B:13:A:0:ダンジョンへ帰還:0:150:r:33:0
 B:$13:A:1:Teleport to dungeon-level:100000:1000000:t:34:0
 B:13:A:1:階を指定してテレポート:100000:1000000:t:34:0
-B:$13:R:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
-B:13:R:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
+B:$13:R:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
+B:13:R:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
 B:$13:M:0:0:0:0:0:2:0:0:0:0
 B:13:M:0:0:0:0:0:2:0:0:0:0

diff --git a/lib/edit/t0000005.txt b/lib/edit/t0000005.txt
index f64b4bb..6bf5f6f 100644
--- a/lib/edit/t0000005.txt
+++ b/lib/edit/t0000005.txt
@@ -128,8 +128,8 @@ B:$4:A:1:Buy food and drink:2:2:f:18:1
 B:4:A:1:食事をする:2:2:f:18:1
 B:$4:A:2:Listen for rumors:10:10:u:19:0
 B:4:A:2:噂を聞く:10:10:u:19:0
-B:$4:R:2:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
-B:4:R:2:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0
+B:$4:R:2:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1
+B:4:R:2:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:0:0:0:0:0:1:1:0:1:0:1:1:1:0:1
 B:$4:A:3:Identify item:100:100:i:44:0
 B:4:A:3:アイテム鑑定:100:100:i:44:0

@@ -152,8 +152,8 @@ B:$14:A:0:Request quest:0:0:q:6:1
 B:14:A:0:クエスト:0:0:q:6:1
 B:$14:A:1:Cure mutation:1000:5000:m:35:0
 B:14:A:1:突然変異を治療する:1000:5000:m:35:0
-B:$14:R:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0
-B:14:R:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0
+B:$14:R:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0
+B:14:R:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0
 B:$14:M:0:0:0:2:0:0:0:0:0:0
 B:14:M:0:0:0:2:0:0:0:0:0:0

その際に配列オーバーのバグも修正しました。

--- a/src/init1.c
+++ b/src/init1.c
@@ -3752,7 +3752,7 @@ static errr parse_line_feature(char *buf)
 static errr parse_line_building(char *buf)
 {
 	int i;
-	char *zz[37];
+	char *zz[1000];
 	int index;
 	char *s;

水流耐性を新しく実装してみる

さて、マーフォークとしての独自の仕様として、やはり水棲種族なのですから、レアな水流耐性など持っていても良いかもしれません。現状として仕様がないので、ここで新しく水流耐性を追加してみます。

まず新しくplayer_type構造体にresist_waterを加えて、calc_nonuses()に初期化を追加、種族がマーフォークならばTRUEにします。

--- a/src/types.h
+++ b/src/types.h
@@ -1248,6 +1248,7 @@ struct player_type
 	bool resist_neth;	/* Resist nether */
 	bool resist_fear;	/* Resist fear */
 	bool resist_time;	/* Resist time */
+	bool resist_water;	/* Resist water */

 	bool reflect;       /* Reflect 'bolt' attacks */
 	bool sh_fire;       /* Fiery 'immolation' effect */
--- a/src/xtra1.c
+++ b/src/xtra1.c
@@ -3290,6 +3290,7 @@ void calc_bonuses(void)
 	p_ptr->resist_blind = FALSE;
 	p_ptr->resist_neth = FALSE;
 	p_ptr->resist_time = FALSE;
+	p_ptr->resist_water = FALSE;
 	p_ptr->resist_fear = FALSE;
 	p_ptr->reflect = FALSE;
 	p_ptr->sh_fire = FALSE;
@@ -3770,6 +3771,8 @@ void calc_bonuses(void)
 			p_ptr->resist_pois = TRUE;
 			p_ptr->hold_exp = TRUE;
 			break;
+		case RACE_MERFOLK:
+			p_ptr->resist_water = TRUE;
 		default:
 			/* Do nothing */
 			;

そしてこの水流耐性がある場合、GF_WATERのダメージを喰らった時、轟音や混乱耐性とは別に朦朧や混乱に陥らず、ダメージが1/4になるようにしましょう。

diff --git a/src/spells1.c b/src/spells1.c
index b0f8750..b10d18b 100644
--- a/src/spells1.c
+++ b/src/spells1.c
@@ -5412,19 +5412,21 @@ static bool project_p(MONSTER_IDX who, cptr who_name, int r, POSITION y, POSITIO
 			if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
 			if (!CHECK_MULTISHADOW())
 			{
-				if (!p_ptr->resist_sound)
+				if (!p_ptr->resist_sound && !p_ptr->resist_water)
 				{
 					set_stun(p_ptr->stun + randint1(40));
 				}
-				if (!p_ptr->resist_conf)
+				if (!p_ptr->resist_conf && !p_ptr->resist_water)
 				{
 					set_confused(p_ptr->confused + randint1(5) + 5);
 				}

-				if (one_in_(5))
+				if (one_in_(5) && !p_ptr->resist_water)
 				{
 					inven_damage(set_cold_destroy, 3);
 				}
+
+				if (p_ptr->resist_water) get_damage /= 4;
 			}

ついでに重量オーバーでも溺れなくなります。

--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -1505,7 +1505,7 @@ static void process_world_aux_hp_and_sp(void)
 	}

 	if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
-	    !p_ptr->levitation && !p_ptr->can_swim)
+	    !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->res_water)
 	{
 		if (p_ptr->total_weight > weight_limit())
 		{

大分それらしくなってきたと思います。このまま間延びですが後編へ。