HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2016
1113
fエクストリームえふすてやま3解決


f

リンク

2016/11/13(Sun) 10:08:25|NO.77325

おひさん?

なんか自分がやりたくなってDIAMANT作ったんで
折角だからここに捨てに来たぜ!

遊び方。
・NPCと、進むか帰るかのチキンレース。
・進むとダイヤモンドが手に入るが、時々事故が起こる。
・ただし、余りはその場に放置する。
・引き返すチキン野郎は、このあまりダイヤを持って帰って構わない。
・ただし、それでも余る時はその場に放置する。
・「同じ事故」に2回かかったら全滅。
・全滅時に帰ってない物は、その回で手に入れた全てのダイヤを失う。

×5セット で、一番ダイヤを集めた者が勝ち。


//---------------------------------------------------------------------------- // DIAMANT ダイヤモンド //---------------------------------------------------------------------------- #packopt name "Diamant" //---------------------------------------------------------------------------- // 定数設定 //---------------------------------------------------------------------------- #define SCR_WIDTH 640 // 主フォーム幅 #define SCR_HEIGHT 480 // 主フォーム高 #define CW_WIDTH 180 // 参加プレイヤーボックス描画サイズ幅 #define CW_HEIGHT 100 // 参加プレイヤーボックス描画サイズ高 #define CD_WIDTH 120 // カード描画サイズ幅 #define CD_HEIGHT 150 // カード描画サイズ高 MAXPLAYER = 6 // プレイヤー数 #enum SCR = 0 // 各プレイヤー情報保持配列インデックス : 得点 #enum MID // 各プレイヤー情報保持配列インデックス : メッセージボックスID #enum WX // 各プレイヤー情報保持配列インデックス : ウィンドウ表示位置横 #enum WY // 各プレイヤー情報保持配列インデックス : ウィンドウ表示位置縦 #enum ALV // 各プレイヤー情報保持配列インデックス : ゲーム参加状態 0:不参加 1:参加 #enum DEC // 各プレイヤー情報保持配列インデックス : ゲーム進行決断 0:思考中 1:進む 2:撤退 #enum TTL // 各プレイヤー情報保持配列インデックス : トータルスコア #enum ARRAYLENGTH // 配列最大数 CARDS = 30 // カード枚数( 20以上10単位位でどうか ) PIH = atan( 1 , 0 ) // 計算用 - ラジアン単位で90度 PI = PIH * 2.0 // 計算用 - ラジアン単位で180度 //---------------------------------------------------------------------------- // ゲーム全体管理 //---------------------------------------------------------------------------- gosub *init // 前期化 ゲームそのものの初期化 gosub *main // 主処理 必要な回数セッションを繰り返す gosub *term // 後処理 ゲームそのものの終了処理 stop //---------------------------------------------------------------------------- // 前処理 //---------------------------------------------------------------------------- *init gosub *screen_init // 画面初期化 randomize // 乱数初期化 // プレイヤー関連初期設定 sdim cname,20,MAXPLAYER // プレイヤー名保持領域 dim cparm ,MAXPLAYER , ARRAYLENGTH // プレイヤーパラメータ保持領域 // カード関連初期設定 dim cd , CARDS // カード保持領域 dim wk , CARDS // カードシャッフル用ワーク領域 dim trap , 5 // トラップカード出現カウンタ(同じトラップが2回出たら終了) sdim cd_name , 20 ,10 // カード名称保持領域 cd_name( 0) = "5 Diamonds Get" // カード名:ダイヤモンドカード「5個ゲット」 cd_name( 1) = "8 Diamonds Get" // カード名:ダイヤモンドカード「8個ゲット」 cd_name( 2) = "12 Diamonds Get" // カード名:ダイヤモンドカード「12個ゲット」 cd_name( 3) = "15 Diamonds Get" // カード名:ダイヤモンドカード「15個ゲット」 cd_name( 4) = "20 Diamonds Get!!" // カード名:ダイヤモンドカード「20個ゲット」 cd_name( 5) = "Accident! Snake!" // カード名:トラップカード「蛇だ!」 cd_name( 6) = "Accident! Rock!" // カード名:トラップカード「岩だ!」 cd_name( 7) = "Accident! Explosion!" // カード名:トラップカード「爆発だ!」 cd_name( 8) = "Accident! Pit!" // カード名:トラップカード「穴だ!」 cd_name( 9) = "Accident! Gas!" // カード名:トラップカード「ガスだ!」 GEOF = 0 // ゲーム終了フラグ return //---------------------------------------------------------------------------- // 主処理 //---------------------------------------------------------------------------- *main gosub *entry // 参加者初期化処理 for cno,0,member // 参加者得点クリア cparm( cno , TTL ) =0 next stage = 0 // ステージカウントクリア while GEOF = 0 // 終了判定まで繰り返す gosub *game // Diamante 1セッションプレイ stage += 1 // ステージを進める if stage >= 5 : GEOF = 1 // 5回で終了 wend return //---------------------------------------------------------------------------- // 後処理 //---------------------------------------------------------------------------- *term // 画面を塗りつぶす gosub *push_color color 64,96,128 boxf 0,0,640,480 // プレイヤーのスコアを表示 pos 0,0 color 255,255,255 for cno,0,member mes cname( cno ) + ":" + cparm( cno , TTL ) next gosub *pop_color return //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // Damante 1セッション //---------------------------------------------------------------------------- *game gosub *game_init // Damante 1セッション前処理 パラメタ初期化等 gosub *game_main // Damante 1セッション主処理 ゲーム本体 gosub *game_term // Damante 1セッション後処理 結果纏め return //---------------------------------------------------------------------------- // ゲーム前処理 //---------------------------------------------------------------------------- *game_init cardcounter = 0 // 現在のカード位置 surplus = 0 // 場に余るダイヤの数 gosub *cards_init // カード初期化 / シャッフル for cno,0,member // プレイヤーパラメタクリア cparm( cno , SCR ) = 0 // 今回セッションの特典 cparm( cno , ALV ) = 1 // 参加中にセット cparm( cno , DEC ) = 0 // 決断状態クリア next for i,0,5 // トラップカウンタークリア trap(i)=0 next return //---------------------------------------------------------------------------- // ゲーム主処理 //---------------------------------------------------------------------------- *game_main gosub *cleardecision // 決断クリア gosub *getaction // 行動選択 gosub *result // 結果表示 cardcounter++ // カードを一枚進める gosub *checkalive // 残りメンバー確認 if alive > 0 :goto *game_main // 続行希望者が居る限りループ // 1セッション完了、画面初期化 redraw 0 gosub *screen_make redraw 1 return //---------------------------------------------------------------------------- // ゲーム後処理 //---------------------------------------------------------------------------- *game_term for cno,0,member // 1セッション得点をトータル得点に加える cparm( cno , TTL ) += cparm( cno , SCR ) next return //---------------------------------------------------------------------------- // ポーズ(スペースが押されるまで待機 //---------------------------------------------------------------------------- *pause await 10 stick st if ( st & 16 ) = 0 :goto *pause return //---------------------------------------------------------------------------- // 行動選択 //---------------------------------------------------------------------------- *getaction secret = 1 // 決定伏せモードON command = 1 // コマンド表示モードON f_flg = 0 // 前進フラグ b_flg = 0 // 撤退フラグ // 生存者集計 gosub *checkalive // 決断者集計 gosub *checkdecision // 全員決断するまでloop while decision != alive // プレイヤー行動 gosub *player_action for cno,1,member gosub *otherplayer_action next // 画面表示 redraw 0 gosub *screen_make redraw 1 wait 10 // 決断者集計 gosub *checkdecision wend return //---------------------------------------------------------------------------- // プレイヤー行動決断 //---------------------------------------------------------------------------- *player_action // 既に確定していたら終了 if cparm( 0 , DEC ) != 0 : return // キー入力 stick st if ( st & 1 ) != 0 { f_flg=1 : b_flg = 0 } if ( st & 4 ) != 0 { f_flg=0 : b_flg = 1 } if ( st & 16 ) != 0 & (f_flg + b_flg) > 0 { cparm( 0 , DEC ) = 2 if f_flg = 1 : cparm( 0 , DEC ) = 1 } return //---------------------------------------------------------------------------- // NPC思考 //---------------------------------------------------------------------------- *otherplayer_action rt_point = 0 // 引き返し決断点(状況が悪いほど数字が上がる) rt_border= 400 // 引き返し境界点(決断点がこの値を超えたら、諦めて帰る) rt_trap = 1 // 状況悪化要因:トラップ出現別点 rt_dia = 20 // 状況悪化要因:残りダイヤ点 rt_depth = 5 // 状況悪化要因:進行深さ点 rt_rand = 200 // 状況悪化要因:乱数 rt_corrc = -100 // 状況悪化要因:修正 // 残りダイヤ点取得 rt_point += surplus * rt_dia // 進行深さ取得 rt_point += cardcounter * rt_depth // ランダム要素取得 rt_point += rnd( rt_rand ) // 修正 rt_point += rt_corrc // トラップ点取得 t=0 for i,0,5 t += trap( i ) * rt_trap next rt_point = t * rt_point // 判定 cparm( cno , DEC ) = 2 if rt_border > rt_point : cparm( cno , DEC ) = 1 return //---------------------------------------------------------------------------- // 残りメンバー確認 //---------------------------------------------------------------------------- *checkalive alive = 0 for cno,0,member if cparm( cno , ALV ) = 1 : alive += 1 next return //---------------------------------------------------------------------------- // 決断クリア //---------------------------------------------------------------------------- *cleardecision for cno,0,member cparm( cno , DEC ) = 0 next return //---------------------------------------------------------------------------- // 決断人数集計 //---------------------------------------------------------------------------- *checkdecision decision = 0 for cno,0,member if cparm( cno , ALV ) != 0 & cparm( cno , DEC ) != 0 : decision += 1 next return //---------------------------------------------------------------------------- // 結果表示 //---------------------------------------------------------------------------- *result secret = 0 // 決定伏せモードオフ command = 0 // コマンド表示モードON redraw 0 gosub *screen_make // 画面表示 redraw 1 // 撤退者にダイヤ配分 gosub *withdrawal // 撤退者は場から消える for cno,0,member if cparm( cno , ALV ) = 1 & cparm( cno , DEC ) = 2 : cparm( cno , ALV ) = 0 next // カードをめくる redraw 0 gosub *screen_make gosub *card_view gosub *event redraw 1 gosub *pause // 前進者にダイヤ配分 gosub *challenge // 余りダイヤをあずける surplus += getdiamonds // 終了チェック e=0 for i,0,5 if trap(i) > 1 : e=1 next // 2回目のトラップ時の残存者は終了&ダイヤクリア if e=1 { for cno,0,member if cparm( cno , ALV ) = 1 { cparm( cno , ALV ) = 0 cparm( cno , SCR ) = 0 } next } return //---------------------------------------------------------------------------- // カード別イベント //---------------------------------------------------------------------------- *event getdiamonds = 0 switch cd(cardcounter) case 0 getdiamonds = 5 swbreak case 1 getdiamonds = 8 swbreak case 2 getdiamonds = 12 swbreak case 3 getdiamonds = 15 swbreak case 4 getdiamonds = 20 swbreak case 5 trap(0) += 1 swbreak case 6 trap(1) += 1 swbreak case 7 trap(2) += 1 swbreak case 8 trap(3) += 1 swbreak case 9 trap(4) += 1 swbreak swend return //---------------------------------------------------------------------------- // 撤退者にダイヤ配分 //---------------------------------------------------------------------------- *withdrawal // 撤退者人数確認 mem = 0 for cno,0,member if cparm( cno , ALV ) = 1 & cparm( cno , DEC ) = 2 { px = cparm(cno,WX) py = cparm(cno,WY) msg = "俺はここで撤退だ!" gosub *character_msg_view mem += 1 } next // 居なければ終了 if mem = 0 : return gosub *pause // 一人分のダイヤ確認 dia = surplus / mem // 配分できるダイヤが無いなら終了 if dia = 0 { return } // 残るダイヤ計算 surplus = surplus \ mem // 配分 redraw 0 gosub *screen_make for cno,0,member if cparm( cno , ALV ) = 1 & cparm( cno , DEC ) = 2 { px = cparm(cno,WX) py = cparm(cno,WY) msg = "" + dia + "個GET!" gosub *character_msg_view cparm( cno , SCR ) += dia } next redraw 1 gosub *pause return //---------------------------------------------------------------------------- // 前進者にダイヤ配分 //---------------------------------------------------------------------------- *challenge // 前進者人数確認 mem = 0 for cno,0,member if cparm( cno , ALV ) = 1 & cparm( cno , DEC ) = 1 : mem += 1 next // 居なければ終了 if mem = 0 : return // 一人分のダイヤ確認 dia = getdiamonds / mem // 配分できるダイヤが無いなら終了 if dia = 0 { return } // 残るダイヤ計算 getdiamonds = getdiamonds \ mem // 配分 redraw 0 gosub *screen_make for cno,0,member if cparm( cno , ALV ) = 1 & cparm( cno , DEC ) = 1 { px = cparm(cno,WX) py = cparm(cno,WY) msg = "" + dia + "個GET!" gosub *character_msg_view cparm( cno , SCR ) += dia } next redraw 1 gosub *pause return //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // ワーク画面準備 //---------------------------------------------------------------------------- *screen_init buffer 1 , 1200,150 pos 25 , 60 : mes "[  5 ]" pos 145 , 60 : mes "[  8 ]" pos 265 , 60 : mes "[ 12 ]" pos 385 , 60 : mes "[ 15 ]" pos 505 , 60 : mes "[ 20 ]" pos 625 , 60 : mes "[ 蛇 ]" pos 745 , 60 : mes "[ 岩 ]" pos 865 , 60 : mes "[ 爆発 ]" pos 985 , 60 : mes "[落し穴]" pos 1105 , 60 : mes "[毒ガス]" buffer 2 pos 25 , 25 : mes "1" pos 95 , 25 : mes "2" pos 165 , 25 : mes "3" pos 235 , 25 : mes "4" pos 305 , 25 : mes "5" pos 375 , 25 : mes "6" buffer 3 pos 7 , 7 : mes "蛇" pos 39 , 7 : mes "岩" pos 71 , 7 : mes "爆" pos 103 , 7 : mes "穴" pos 135 , 7 : mes "毒" screen 0,SCR_WIDTH,SCR_HEIGHT font "MS ゴシック",16 objmode 2 gsel 0 return //---------------------------------------------------------------------------- // セッション画面表示 //---------------------------------------------------------------------------- *screen_make gosub *push_color color 64,96,128 boxf 0,0,640,480 // プレイヤーボックス表示 for cno,0,member px = cparm(cno,WX) py = cparm(cno,WY) gosub *playerbox next // トラップ状況 color 200,64,128 boxf 0,0,160,32 color 64,64,64 for i,0,5 boxf (i * 32) + 1 ,1 , (i * 32) + 30 , 30 next color 255,128,128 for i,0,5 pos (i * 32) + 1 ,1 if trap(i)!=0 :gcopy 3,i*32,0,32,32 next // コマンド表示 if command = 1 { px = 420 py = 400 gosub *command_view } // 余りダイヤ表示 if surplus > 0 { px = 60 py = 430 gosub *surplus_view } gosub *pop_color return //---------------------------------------------------------------------------- // カード描画 //---------------------------------------------------------------------------- *card_view px = (SCR_WIDTH - CD_WIDTH ) /2 py = (SCR_HEIGHT - CD_HEIGHT) /2 gmode 0 pos px,py gcopy 1 , cd(cardcounter) * 120 , 0 , CD_WIDTH,CD_HEIGHT return //---------------------------------------------------------------------------- // キャラクターコメント表示 //---------------------------------------------------------------------------- *character_msg_view color 255 , 255 , 255 boxf px + 8, py - 8, px + 8 + strlen(msg) * 8 + 16 , py - 8 + 32 color 0 , 0 , 0 pos px + 16 , py : mes msg return //---------------------------------------------------------------------------- // プレイヤーボックス表示 //---------------------------------------------------------------------------- *playerbox // 外枠 color 196 , 196 , 196 boxf px , py , px + CW_WIDTH , py + CW_HEIGHT // キャラクター画 gmode 0 pos px + 8 , py + 8 gcopy 2 , cno * 70 , 0 , 70,70 // 続行状態 if cparm( cno , ALV ) = 1 { color 200 , 255 , 200 } else { color 128 , 64 , 64 } boxf px + 88 , py + 8 , px + 88 + 80 , py + 8 + 16 // 決断 if cparm( cno , ALV ) = 1 { if secret = 0 { msg = "前進" if cparm( cno , DEC ) = 2 : msg = "撤収" } else { msg = "未定" if cparm( cno , DEC ) != 0 : msg = "決定" } color 0 , 0 , 0 pos px + 85 , py + 29 : mes "行 動:" + msg color 255,255,255 pos px + 84 , py + 28 : mes "行 動:" + msg } // 得点 msg = "ダイヤ:" + strf("%4d" , cparm( cno , SCR ) ) color 0 , 0 , 0 pos px + 85 , py + 49 : mes msg color 255,255,255 pos px + 84 , py + 48 : mes msg // 得点 msg = "得点 :" + strf("%4d" , cparm( cno , TTL ) ) color 0 , 0 , 0 pos px + 85 , py + 69 : mes msg color 255,255,255 pos px + 84 , py + 68 : mes msg // 名前 color 0 , 0 , 0 pos px + 9 , py + 81 : mes cname( cno ) color 255,255,255 pos px + 8 , py + 80 : mes cname( cno ) return //---------------------------------------------------------------------------- // コマンド領域表示 //---------------------------------------------------------------------------- *command_view color 160,160,255 boxf px , py , px + 160 , py + 64 if f_flg = 0 { color 100,155,100 } else { color 200,255,100 } boxf px + 8 , py + 30 , px + 8 + 64 , py + 30 + 20 if b_flg = 0 { color 155,100,100 } else { color 255,200,200 } boxf px + 88 , py + 30 , px + 88 + 64 , py + 30 + 20 color 0,0,0 pos px + 9 , py + 9 : mes "どうする?" pos px + 25 , py + 33 : mes "前進" pos px + 105 , py + 33 : mes "撤退" color 255,255,255 pos px + 8 , py + 8 : mes "どうする?" pos px + 24 , py + 32 : mes "前進" pos px + 104 , py + 32 : mes "撤退" return //---------------------------------------------------------------------------- // 余りダイヤ表示 //---------------------------------------------------------------------------- *surplus_view color 200,200,255 boxf px , py , px+160 , py+32 color 0,0,0 pos px + 17 , py + 9 : mes "余りダイヤ:" + strf("%4d" , surplus) color 255,255,255 pos px + 16 , py + 8 : mes "余りダイヤ:" + strf("%4d" , surplus) return //---------------------------------------------------------------------------- // カレントカラー保持 //---------------------------------------------------------------------------- *push_color stack_r = ginfo(16) stack_g = ginfo(17) stack_b = ginfo(18) return //---------------------------------------------------------------------------- // カレントカラー復帰 //---------------------------------------------------------------------------- *pop_color color stack_r,stack_g,stackb return //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // エントリー 参加プレイヤー受付処理 //---------------------------------------------------------------------------- *entry gosub *entry_init // エントリー前処理 gosub *entry_main // エントリー主処理 gosub *entry_term // エントリー後処理 return //---------------------------------------------------------------------------- // エントリー前処理 //---------------------------------------------------------------------------- *entry_init // プレイヤーデータ初期化 // 仮設定 cname(0) = "プレイヤー" cparm(0,SCR) = 0 cparm(0,ALV) = 1 for cno , 1 , MAXPLAYER cname( cno ) = "NPC_" + cno cparm( cno , SCR ) = 0 cparm( cno , ALV ) = 1 next member = MAXPLAYER gosub *checkalive return //---------------------------------------------------------------------------- // エントリー主処理 //---------------------------------------------------------------------------- *entry_main return //---------------------------------------------------------------------------- // エントリー後処理 //---------------------------------------------------------------------------- *entry_term // プレイヤー数別キャラクターウィンドウ配置位置算出 if SCR_WIDTH > SCR_HEIGHT { r = double( SCR_HEIGHT - CW_HEIGHT ) / 2 } else { r = double( SCR_WIDTH - CW_WIDTH ) / 2 } rateH = double( SCR_WIDTH - CW_WIDTH ) / ( SCR_HEIGHT - CW_HEIGHT ) rateV = double( SCR_HEIGHT - CW_HEIGHT ) / ( SCR_WIDTH - CW_WIDTH ) for cno,0,member trg_deg = 0.0 + ( 360.0 / member ) * cno cparm(cno,WX) = (SCR_WIDTH / 2) - ( ( r * rateH ) * sin( trg_deg * ( PI / 180.0) ) ) - ( CW_WIDTH / 2) cparm(cno,WY) = (SCR_HEIGHT / 2) + ( ( r * rateV ) * cos( trg_deg * ( PI / 180.0) ) ) - ( CW_HEIGHT / 2) next return //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // カード初期化 //---------------------------------------------------------------------------- *cards_init index =0 // ダイヤモンドカード追加 for o,0,( CARDS / 10 ) - 1 // カード枚数(10枚単位)分繰り返す cd( index ) = 0 : index++ // カード名:ダイヤモンドカード「5個ゲット」追加 cd( index ) = 0 : index++ // カード名:ダイヤモンドカード「5個ゲット」追加 cd( index ) = 0 : index++ // カード名:ダイヤモンドカード「5個ゲット」追加 cd( index ) = 1 : index++ // カード名:ダイヤモンドカード「8個ゲット」追加 cd( index ) = 1 : index++ // カード名:ダイヤモンドカード「8個ゲット」追加 cd( index ) = 1 : index++ // カード名:ダイヤモンドカード「8個ゲット」追加 cd( index ) = 2 : index++ // カード名:ダイヤモンドカード「12個ゲット」追加 cd( index ) = 2 : index++ // カード名:ダイヤモンドカード「12個ゲット」追加 cd( index ) = 3 : index++ // カード名:ダイヤモンドカード「15個ゲット」追加 cd( index ) = 3 : index++ // カード名:ダイヤモンドカード「15個ゲット」追加 next cd(index-1) = 4 // 最後の15ゲットを20ゲットに // 事故カード2枚づつ for i,0,2 // 必ず2枚づつある cd(index) = 5 : index++ // カード名:トラップカード「蛇だ!」 cd(index) = 6 : index++ // カード名:トラップカード「岩だ!」 cd(index) = 7 : index++ // カード名:トラップカード「爆発だ!」 cd(index) = 8 : index++ // カード名:トラップカード「穴だ!」 cd(index) = 9 : index++ // カード名:トラップカード「ガスだ!」 next gosub *shuffle return //---------------------------------------------------------------------------- // カードシャッフル //---------------------------------------------------------------------------- *shuffle for i,0,CARDS // 全カードに対して tmp = cd( i ) // 現在の順番のカード内容を控える r = rnd( CARDS ) // 交換先のカード番号を決める cd( i ) = cd( r ) // 現在カードに、交換先カードの内容を入れる cd( r ) = tmp // 現在カードの控えだったものを、交換先カードの内容にする next return



この記事に返信する


Ve

リンク

2016/11/13(Sun) 15:46:46|NO.77326

懐かしいスレッドが建っている・・・だと・・・



Ve

リンク

2016/11/13(Sun) 15:53:02|NO.77327

グラフィック付けたり、追加ルール入れても良いですね。面白いゲームでした。



f

リンク

2016/11/15(Tue) 08:39:13|NO.77329

ウホッ?思ってたより進行してない。
何?HSP掲示板、最近は過疎ってんの?

あ、評価有難うござい。



ONION software Copyright 1997-2023(c) All rights reserved.