Miyuns 0 Posted June 26, 2013 hi im new on this forum. i found this script that is basically for making a card game with vxace but i have a question. in this script u can have max 3 cards, i tried to add more but it won't show on the menu: and id like to make it so that i have like 4000 hp like yu-gi-oh and monster have ATK and DEF, bcs this script have cards with HP and ATK and u do dmg to other cards and destroy them... Those are the scripts: #============================================================================== # â– Settings #============================================================================== module TMCARD SW_CAN_CANCEL = 1 # Switch number of deck selection cancellation flag SW_USE_MENU_EDIT = 2 # Switch number of deck editing commands add flag SW_USE_MENU_TEST = 3 # Switch number of mock duel command additional flags VN_RESULT = 1 # Game variable number that is assigned the result of the game VN_COST_MAX = 2 # Game variable number to set the cost limit of the deck # Name of various parameters TX_NAME = "Name" TX_RARE = "Rare degree" TX_COST = "Cost" TX_HP = "HP" TX_ATK = "ATK" TX_TYPE = "Type" TX_SKILL = "Skill" TX_ELEMENT = "Att" TYPE_NAME = ["Att", "Skill", "Supp", "Magic"] # Type name TYPE_ICON = [131, 133, 139, 136] # Type icon ID ELEMENT_NAME = ["Fire", "Ice", "Thunder", "Water", "Earth", "Wind", "Light", "Dark"] # Property Name RARE_NAME = ["Common", "Uncommon", "Rare", "Legend"] # 稀少度å DECK_EDIT = "Deck editing" # Name of the menu in the deck edit DECK_TEST = "Simulated Duel" # Name of the menu of the simulated Duel # (I set the same number as the maximum number of deck) # string to give the ending of the deck name DECK_LETTER = ["A", "ï¼¢", "ï¼£", "D", "ï¼¥"] # Whether or not to generate a script graphics card # false It will be used as graphics card as it is the #image that you prepared when I make a USE_AUTO_TEXT = true DECK_MAX = 5 # Maximum number of registerable deck TYPE_SPEED = [1, 4, 0, 2] # Speed ​​value for each type ATK_MAX = 8 # Attack Shock Force Full Caps AUTO_WAIT = 30 # Weight of automatic progression mode (frame) WIDTH_STATUS_WINDOW = 240 # Width of card status window ANIME_SKILL = 40 # ID of the animation skills when using ANIME_BONUS = 44 # Animation type ID bonus upon activation ANIME_DAMAGE = 1 # ID of the attack animation end #============================================================================== # â– Game_Party #============================================================================== class Game_Party #-------------------------------------------------------------------------- # â— Object initialization #-------------------------------------------------------------------------- alias tmcard_game_party_initialize initialize def initialize tmcard_game_party_initialize @deck = [] (0...TMCARD::DECK_MAX).each {|i| @deck[i] = [0, 0, 0] } @active_deck = 0 end #-------------------------------------------------------------------------- # â—‹ Returns the deck that you specify #-------------------------------------------------------------------------- def deck(index) @deck[index] end #-------------------------------------------------------------------------- # â—‹ return the total cost of the deck that you specify #-------------------------------------------------------------------------- def cost(index) n = 0 cards(index).each {|item| n += item.c_cost if item } n end #-------------------------------------------------------------------------- # â—‹ set the active deck #-------------------------------------------------------------------------- def set_active_deck(index) @active_deck = index end #-------------------------------------------------------------------------- # â—‹ Return (the one to be used in battle) active deck #-------------------------------------------------------------------------- def active_deck @deck[@active_deck] end #-------------------------------------------------------------------------- # â—‹ Get array of card objects #-------------------------------------------------------------------------- def cards(index) result = [] deck(index).each {|id| result.push($data_items[id]) } result end #-------------------------------------------------------------------------- # â—‹ (Specified in the object) Change Card #-------------------------------------------------------------------------- def change_card(index, equip_type, item) last_item = cards(index)[equip_type] return if item && item_number(item) == 0 gain_item(last_item, 1) lose_item(item, 1) @deck[index][equip_type] = (item ? item.id : 0) end end #============================================================================== # â– Game_Interpreter #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # â—‹ (Which returns true if there is at least one valid deck) Deck Check #-------------------------------------------------------------------------- def deck_valid? (0...TMCARD::DECK_MAX).each do |i| return true unless $game_party.deck(i).include?(0) end false end #-------------------------------------------------------------------------- # â—‹ The start of the card game #-------------------------------------------------------------------------- def start_duel(enemy = [1, 2, 3], name = "Opponent") return false unless deck_valid? $game_temp.card_enemy_deck = enemy $game_temp.card_enemy_name = name SceneManager.call(Scene_DeckSelect) true end #-------------------------------------------------------------------------- # â—‹ The start of the test game #-------------------------------------------------------------------------- def start_test return false unless deck_valid? SceneManager.call(Scene_DeckTest) true end #-------------------------------------------------------------------------- # â—‹ Remove all the cards in the deck that you specify #-------------------------------------------------------------------------- def remove_card_all(deck_index) (0...3).each {|i| $game_party.change_card(deck_index, i, nil) } end #-------------------------------------------------------------------------- # â—‹ To build a deck in the card that you specify #-------------------------------------------------------------------------- def make_deck(deck_index, cards) (0...3).each do |i| item = $data_items[cards[i]] $game_party.change_card(deck_index, i, item) end end end #============================================================================== # â–¡ Game_Deck #============================================================================== class Game_Deck #-------------------------------------------------------------------------- # â—‹ Public instance variable #-------------------------------------------------------------------------- attr_reader :cost # Total cost of the deck attr_reader :lose # Number of cards you defeat attr_accessor :deck # Card deck attr_accessor :name # The name of the player attr_accessor :skill # Skill attr_accessor :skill_cnt # Skill number attr_accessor :used_skill # Skill flag of turn in attr_accessor :hp # HP attr_accessor :jp # JP attr_accessor :hp_draw # Drawing HP attr_accessor :jp_draw # Drawing JP attr_accessor :refresh_move # Card location update flag #-------------------------------------------------------------------------- # â—‹ Object initialization #-------------------------------------------------------------------------- def initialize(card, name) @deck = [] (0...3).each {|i| @deck.push(Game_Card.new(card[i])) } @name = name @lose = 0 @cost = 0 @skill = [] (0...3).each do |i| @skill[i] = @deck[i].skill(0) @cost += @deck[i].cost end @skill[3] = @deck[0].skill(1) @skill_cnt = [0, 0, 0, 0] @used_skill = [] @hp = @deck[0].hp @jp = @deck[0].atk @hp_draw = 0 @jp_draw = 0 @refresh_move = false end #-------------------------------------------------------------------------- # â—‹ ターン開始時ã®åˆæœŸåŒ–å‡¦ç† #-------------------------------------------------------------------------- def init_turn_start @used_skill = [] card.increase_turn # Number of turns added end #-------------------------------------------------------------------------- # â—‹ 戦闘ä¸èƒ½æ™‚ã®å‡¦ç† #-------------------------------------------------------------------------- def knockout card.down # I translucent card reset_skill_cnt # Skill Frequency Reset @lose += 1 # Defeat number of cards added set_next if @lose < 3 # Set the next card end #-------------------------------------------------------------------------- # â—‹ 次ã®ã‚«ãƒ¼ãƒ‰ã‚’セット #-------------------------------------------------------------------------- def set_next @hp = card.hp @jp = [card.atk, $game_duel.jp_max].min @hp_draw = @hp @jp_draw = @jp @skill[3] = card.skill(1) @refresh_move = true end #-------------------------------------------------------------------------- # â—‹ スã‚ル使用回数リセット #-------------------------------------------------------------------------- def reset_skill_cnt @skill_cnt = [0, 0, 0, 0] end #-------------------------------------------------------------------------- # â—‹ アクティブãªã‚«ãƒ¼ãƒ‰ã‚’返㙠#-------------------------------------------------------------------------- def card @deck[@lose] end #-------------------------------------------------------------------------- # â—‹ カードã®ã‚³ã‚¹ãƒˆå€¤ã‚’返㙠#-------------------------------------------------------------------------- def cost(index = -1) @deck[index == -1 ? @lose : index].cost end #-------------------------------------------------------------------------- # â—‹ カードã®ã‚¿ã‚¤ãƒ—値を返㙠#-------------------------------------------------------------------------- def type(index = -1) @deck[index == -1 ? @lose : index].type end #-------------------------------------------------------------------------- # â—‹ カードã®å±žæ€§å€¤ã‚’返㙠#-------------------------------------------------------------------------- def element(index = -1) @deck[index == -1 ? @lose : index].element end #-------------------------------------------------------------------------- # â—‹ カードã®ãƒ¬ã‚¢ãƒªãƒ†ã‚£å€¤ã‚’返㙠#-------------------------------------------------------------------------- def rare(index = -1) @deck[index == -1 ? @lose : index].rare end #-------------------------------------------------------------------------- # â—‹ カードã®ã‚¿ãƒ¼ãƒ³æ•°ã‚’返㙠#-------------------------------------------------------------------------- def turn(index = -1) @deck[index == -1 ? @lose : index].turn end end #============================================================================== # â–¡ Game_Card #============================================================================== class Game_Card #-------------------------------------------------------------------------- # â—‹ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :opacity # 逿˜Žåº¦ attr_reader :file_name # カードã®ç”»åƒãƒ•ァイルå attr_reader :turn # ã‚«ãƒ¼ãƒ‰å›ºæœ‰ã‚¿ãƒ¼ãƒ³çµŒéŽæ•° attr_reader :state # カードã®çŠ¶æ…‹ #-------------------------------------------------------------------------- # â—‹ ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize(id) @card = $data_items[id] @file_name = sprintf("card_%d", id) @opacity = 255 @turn = 0 @state = 0 end #-------------------------------------------------------------------------- # â—‹ ターンã®å¢—åŠ #-------------------------------------------------------------------------- def increase_turn @turn += 1 end #-------------------------------------------------------------------------- # â—‹ 状態ã®ä»˜åŠ #-------------------------------------------------------------------------- def add_state(value) @state |= value end #-------------------------------------------------------------------------- # â—‹ 逿˜Žåº¦ã‚’5ï¼ï¼…ã«ã™ã‚‹ #-------------------------------------------------------------------------- def down @opacity = 128 end #-------------------------------------------------------------------------- # â—‹ å„種パラメータå–å¾— #-------------------------------------------------------------------------- def id; @card.id; end def name; @card.name; end def cost; @card.c_cost; end def hp; @card.c_hp; end def atk; @card.c_atk; end def type; @card.c_type; end def element; @card.c_element; end def rare; @card.c_rare; end def skill(index); @card.c_skill(index); end end #============================================================================== # â–¡ Sprite_Info #============================================================================== class Sprite_Info < Sprite #-------------------------------------------------------------------------- # ◠公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :hp # Drawing for the HP attr_accessor :jp # æç”»ç”¨ï¼ªï¼° #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize super(nil) @player = $game_duel.player self.bitmap = Bitmap.new(Graphics.width, Graphics.height) self.z = 300 @hp = [0, 0] @jp = [0, 0] # プレイヤーåã®æç”» self.bitmap.fill_rect(0, 8, width, 24, Color.new(0, 0, 0, 128)) self.bitmap.draw_text(16, 8, width - 32, 24, @player[0].name) self.bitmap.draw_text(16, 8, width - 32, 24, @player[1].name, 2) refresh end #-------------------------------------------------------------------------- # ◠解放 #-------------------------------------------------------------------------- def dispose self.bitmap.dispose super end #-------------------------------------------------------------------------- # ◠フレーム更新 #-------------------------------------------------------------------------- def update flag = false (0...2).each do |i| if @hp[i] != @player[i].hp_draw @hp[i] += @hp[i] < @player[i].hp_draw ? 1 : -1 flag = true end if @jp[i] != @player[i].jp_draw @jp[i] += @jp[i] < @player[i].jp_draw ? 1 : -1 flag = true end end refresh if flag end #-------------------------------------------------------------------------- # â—‹ メッセージをセット #-------------------------------------------------------------------------- def set_message(text) self.bitmap.clear_rect(0, 376, width, 24) self.bitmap.font.name = Font.default_name self.bitmap.font.shadow = true self.bitmap.font.size = 20 self.bitmap.font.color = Color.new(255, 255, 255) self.bitmap.fill_rect(0, 376, width, 24, Color.new(0, 0, 0, 128)) self.bitmap.draw_text(0, 376, width, 24, text, 1) end #-------------------------------------------------------------------------- # â—‹ 数値ãŒå¤‰åŒ–ä¸ã‹ã©ã†ã‹ã‚’返㙠#-------------------------------------------------------------------------- def drawing? (0...2).each do |i| return true if @hp[i] != @player[i].hp_draw return true if @jp[i] != @player[i].jp_draw end false end #-------------------------------------------------------------------------- # â—‹ å†æç”» #-------------------------------------------------------------------------- def refresh self.bitmap.clear_rect(0, 240, width, 128) self.bitmap.font.name = ["Arial Black", "VL Gothic"] self.bitmap.font.shadow = false self.bitmap.font.size = 96 self.bitmap.font.color = Color.new(0, 0, 0) self.bitmap.font.out_color.set(255, 255, 255) self.bitmap.draw_text(16, 256, 128, 96, @hp[0].to_s, 1) self.bitmap.draw_text(400, 256, 128, 96, @hp[1].to_s, 1) self.bitmap.font.size = 64 self.bitmap.font.color = Color.new(224, 0, 0) self.bitmap.font.out_color.set(0, 0, 0) self.bitmap.draw_text(80, 256, 128, 64, @jp[0].to_s, 1) self.bitmap.draw_text(336, 256, 128, 64, @jp[1].to_s, 1) end end #============================================================================== # â–¡ Sprite_Cursor #============================================================================== class Sprite_Cursor < Sprite #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize super(nil) @turn = $game_duel.turn self.bitmap = Cache.system("effect") self.x = @turn == 0 ? 80 : 464 self.y = 304 self.z = 200 self.ox = 64 self.oy = 64 self.blend_type = 1 self.opacity = 160 @move_cnt = 8 @move_dist = 0 @last_x = 0 end #-------------------------------------------------------------------------- # ◠解放 #-------------------------------------------------------------------------- def dispose self.bitmap.dispose super end #-------------------------------------------------------------------------- # ◠フレーム更新 #-------------------------------------------------------------------------- def update move if @turn != $game_duel.turn # 回転 self.angle -= 1 self.angle += 360 if self.angle < 0 # サイズ変更 self.zoom_x = Math.sin( self.angle * Math::PI / 180 ) * 0.25 + 1.0 ; self.zoom_y = self.zoom_x # 移動 if @move_cnt < 8 @move_cnt += 1 d = Math.sin(@move_cnt * Math::PI / 16) self.x = @last_x + d * @move_dist end end #-------------------------------------------------------------------------- # â—‹ 移動先ã®è¨å®š #-------------------------------------------------------------------------- def move @turn = $game_duel.turn @last_x = self.x @move_dist = (@turn == 0 ? 80 : 464) - self.x @move_cnt = 0 end end #============================================================================== # â–¡ Sprite_Card #============================================================================== class Sprite_Card < Sprite_Base #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize(card) super(nil) @card = card make_card_bitmap self.z = 250 @shake_x = 0 @shake_angle = 0.0 @move_cnt = 64 @move_dist = [0, 0, 1.0] @last_pos = [0, 0, 1.0] end #-------------------------------------------------------------------------- # â—‹ カードグラフィックã®ä½œæˆ #-------------------------------------------------------------------------- def make_card_bitmap return unless @card self.bitmap.dispose if self.bitmap if TMCARD::USE_AUTO_TEXT self.bitmap = Bitmap.new(128, 192) bitmap_back = Cache.system("c_back_#{@card.rare}") self.bitmap.blt(0, 0, bitmap_back, bitmap_back.rect) bitmap_picture = Bitmap.new("Graphics/Pictures/#{@card.file_name}") self.bitmap.blt(0, 0, bitmap_picture, bitmap_picture.rect) bitmap_picture.dispose bitmap_frame = Cache.system("c_frame_#{@card.element}") self.bitmap.blt(0, 0, bitmap_frame, bitmap_frame.rect) bitmap_rare = Cache.system("c_rare_#{@card.rare}") self.bitmap.blt(0, 0, bitmap_rare, bitmap_rare.rect) self.bitmap.font.name = "VL Gothic" self.bitmap.font.size = 16 self.bitmap.font.color.set(0, 0, 0) self.bitmap.font.out_color.set(255, 255, 255) self.bitmap.draw_text(23, 5, 99, 16, @card.name) self.bitmap.draw_text(6, 151, 116, 16, "★" + @card.skill(0).name) self.bitmap.draw_text(6, 169, 116, 16, "☆" + @card.skill(1).name) self.bitmap.font.name = ["Arial Black", "VL Gothic"] self.bitmap.font.size = 18 text = sprintf("%d / %d", @card.hp, @card.atk) self.bitmap.draw_text(81, 116, 41, 16, text, 1) self.bitmap.draw_text(6, 116, 25, 16, @card.cost, 1) bitmap_icon = Cache.system("IconSet") index = TMCARD::TYPE_ICON[@card.type] rect = Rect.new(index % 16 * 24, index / 16 * 24, 24, 24) self.bitmap.blt(0, 0, bitmap_icon, rect) else self.bitmap = Cache.picture(@card.file_name) end end #-------------------------------------------------------------------------- # ◠解放 #-------------------------------------------------------------------------- def dispose self.bitmap.dispose super end #-------------------------------------------------------------------------- # â—‹ ä½ç½®ã¨ã‚µã‚¤ã‚ºã®å¤‰æ›´ #-------------------------------------------------------------------------- def set(x, y, xsize, ysize) self.x = x self.y = y self.zoom_x = xsize self.zoom_y = ysize @base_x = x end #-------------------------------------------------------------------------- # â—‹ 移動先ã®è¨å®š #-------------------------------------------------------------------------- def move(x, y, size) @last_pos = [self.x, self.y, self.zoom_x] @move_dist = [x - self.x, y - self.y, size - self.zoom_x] @move_cnt = 0 end #-------------------------------------------------------------------------- # â—‹ æºã‚‰ã™ #-------------------------------------------------------------------------- def shake @shake_x = 32 @angle_x = 0.0 end #-------------------------------------------------------------------------- # â—‹ æºã‚Œã¦ã„ã‚‹ã‹ã©ã†ã‹ã‚’返㙠#-------------------------------------------------------------------------- def shake? return @shake_x > 0 end #-------------------------------------------------------------------------- # ◠フレーム更新 #-------------------------------------------------------------------------- def update super if @shake_x > 0 @angle_x += 0.7 @shake_x -= 1 self.x = @base_x + (Math.cos(@angle_x) * @shake_x).to_i end if @move_cnt < 64 @move_cnt += 4 d = Math.sin(@move_cnt * Math::PI / 128) self.x = @last_pos[0] + d * @move_dist[0] self.y = @last_pos[1] + d * @move_dist[1] self.zoom_x = @last_pos[2] + d * @move_dist[2] self.zoom_y = self.zoom_x @base_x = self.x end self.opacity = @card.opacity end end #============================================================================== # â–¡ Spriteset_Card #============================================================================== class Spriteset_Card #-------------------------------------------------------------------------- # â—‹ ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize @sprite_info = Sprite_Info.new @sprite_cursor = Sprite_Cursor.new @sprite_card = [] (0...2).each do |i| @sprite_card[i] = [ Sprite_Card.new($game_duel.player[i].deck[0]), Sprite_Card.new($game_duel.player[i].deck[1]), Sprite_Card.new($game_duel.player[i].deck[2]) ] end @sprite_card[0][0].set(16, 48, 1.0, 1.0) @sprite_card[0][1].set(144, 40, 0.5, 0.5) @sprite_card[0][2].set(208, 40, 0.5, 0.5) @sprite_card[1][0].set(400, 48, 1.0, 1.0) @sprite_card[1][1].set(336, 152, 0.5, 0.5) @sprite_card[1][2].set(272, 152, 0.5, 0.5) end #-------------------------------------------------------------------------- # â—‹ 解放 #-------------------------------------------------------------------------- def dispose @sprite_info.dispose @sprite_cursor.dispose (0...2).each do |i| (0...3).each {|j| @sprite_card[i][j].dispose } end end #-------------------------------------------------------------------------- # â—‹ フレーム更新 #-------------------------------------------------------------------------- def update # ダメージエフェクト (0...2).each do |i| index = $game_duel.player[i].lose sprite = @sprite_card[i][index] next if index == 3 if @sprite_info.hp[i] > $game_duel.player[i].hp_draw && !sprite.shake? sprite.shake # カードをæºã‚‰ã™ sprite.start_animation($data_animations[TMCARD::ANIME_DAMAGE]) if $game_duel.player[i].hp_draw == 0 i == 0 ? Sound.play_actor_collapse : Sound.play_enemy_collapse end end end @sprite_info.update @sprite_cursor.update (0...3).each do |i| @sprite_card[0][i].update @sprite_card[1][i].update end end #-------------------------------------------------------------------------- # â—‹ カードを移動ã•ã›ã‚‹ #-------------------------------------------------------------------------- def move_card(user) if user == 0 if $game_duel.player[0].lose == 1 @sprite_card[0][0].move(208, 40, 0.5) @sprite_card[0][1].move(16, 48, 1.0) @sprite_card[0][2].move(144, 40, 0.5) else @sprite_card[0][0].move(144, 40, 0.5) @sprite_card[0][1].move(208, 40, 0.5) @sprite_card[0][2].move(16, 48, 1.0) end $game_duel.player[0].refresh_move = false else if $game_duel.player[1].lose == 1 @sprite_card[1][0].move(272, 152, 0.5) @sprite_card[1][1].move(400, 48, 1.0) @sprite_card[1][2].move(336, 152, 0.5) else @sprite_card[1][0].move(336, 152, 0.5) @sprite_card[1][1].move(272, 152, 0.5) @sprite_card[1][2].move(400, 48, 1.0) end $game_duel.player[1].refresh_move = false end end #-------------------------------------------------------------------------- # â—‹ メッセージをセット #-------------------------------------------------------------------------- def set_message(text) @sprite_info.set_message(text) end #-------------------------------------------------------------------------- # â—‹ 数値ãŒå¤‰åŒ–ä¸ã‹ã©ã†ã‹ã‚’返㙠#-------------------------------------------------------------------------- def drawing? @sprite_info.drawing? end #-------------------------------------------------------------------------- # â—‹ カードã®ã‚¢ãƒ‹ãƒ¡ãƒ¼ã‚·ãƒ§ãƒ³ã‚’é–‹å§‹ #-------------------------------------------------------------------------- def start_animation(user, index, animation_id) animation = $data_animations[animation_id] @sprite_card[user][index].start_animation(animation) end end #============================================================================== # â–¡ Game_Duel #============================================================================== class Game_Duel #-------------------------------------------------------------------------- # â—‹ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :player # プレイヤー attr_reader :turn # ターン attr_reader :message # メッセージ attr_reader :jp_max # 攻撃力ã®ä¸Šé™ attr_accessor :auto_flag # オートフラグ #-------------------------------------------------------------------------- # â—‹ セットアップ #-------------------------------------------------------------------------- def setup(enemy, name) @player = [ Game_Deck.new($game_party.active_deck, $game_party.name), Game_Deck.new(enemy, name) ] @phase = 0 @damage = 0 @jp_max = TMCARD::ATK_MAX # JP上é™å€¤ @type_bonus = true # タイプボーナス有効フラグ @turn = get_first # 先攻決定 @message = [] @map_bgm = RPG::BGM.last @map_bgs = RPG::BGS.last RPG::BGM.stop RPG::BGS.stop Sound.play_battle_start $game_system.battle_bgm.play @auto_flag = false end #-------------------------------------------------------------------------- # â—‹ 先攻決定 #-------------------------------------------------------------------------- def get_first if @player[0].cost != @player[1].cost # åˆè¨ˆã‚³ã‚¹ãƒˆæ¯”較 return (@player[0].cost < @player[1].cost ? 0 : 1) end (0...3).each do |i| # タイプ値比較 a = TMCARD::TYPE_SPEED[@player[0].type(i)] b = TMCARD::TYPE_SPEED[@player[1].type(i)] return (a > b ? 0 : 1) if a != b # HP比較 a = @player[0].deck[i].hp b = @player[1].deck[i].hp return (a < b ? 0 : 1) if a != b # JP比較 a = @player[0].deck[i].atk b = @player[1].deck[i].atk return (a < b ? 0 : 1) if a != b end # カードID比較 (0...3).each do |i| a = @player[0].deck[i].id b = @player[1].deck[i].id return (a < b ? 0 : 1) if a != b end return 1 # ã¾ã£ãŸãåŒã˜ãƒ‡ãƒƒã‚ã®å ´åˆã¯æ•µãŒå…ˆæ”» end #-------------------------------------------------------------------------- # â—‹ アクティブãªãƒ—レイヤーを返㙠#-------------------------------------------------------------------------- def active_player @player[@turn] end #-------------------------------------------------------------------------- # â—‹ フレーム更新 #-------------------------------------------------------------------------- def update attacker = @player[@turn] target = @player[@turn ^ 1] case @phase when 0 # 準備フェイズ attacker.init_turn_start # ターン開始時ã®åˆæœŸåŒ–å‡¦ç† add_message(sprintf("%s Turn", attacker.name)) update_rebound(attacker) # スã‚ルã®åå‹•å‡¦ç† check_skill # スã‚ル発動ãƒã‚§ãƒƒã‚¯ @phase += 1 # 次ã®ãƒ•ェイズ㸠when 1 # 計算フェイズ add_message(sprintf("%s Attacks", attacker.card.name)) @damage = attacker.jp apply_type_bonus(attacker, target) # タイプボーナスã®é©ç”¨ check_skill # スã‚ル発動ãƒã‚§ãƒƒã‚¯ @phase += 1 # 次ã®ãƒ•ェイズ㸠when 2 # 攻撃フェイズ target.hp = [target.hp - @damage, 0].max add_message(sprintf("%s To %d Damage", target.card.name, @damage)) # HPã«å¤‰åŒ–ãŒã‚ã‚‹é™ã‚Šã‚¹ã‚ル発動ãƒã‚§ãƒƒã‚¯ã‚’繰り返㙠while(1) a = attacker.hp b = target.hp check_skill break if a == attacker.hp && b == target.hp end @phase += 1 # 次ã®ãƒ•ェイズ㸠when 3 # 判定フェイズ @player.each {|deck| deck.knockout if deck.hp == 0 } # 戦闘ä¸èƒ½åˆ¤å®š judge_win_loss # 勿•—判定 @phase += 1 # 次ã®ãƒ•ェイズ㸠else # 終了フェイズ @turn = @turn ^ 1 @phase = 0 end end #-------------------------------------------------------------------------- # â—‹ スã‚ルã®åå‹•å‡¦ç† #-------------------------------------------------------------------------- def update_rebound(attacker) # 毎ターン攻撃力+1 if attacker.card.state & 2 != 0 && attacker.jp < @jp_max attacker.jp += 1 add_message(sprintf("Reaction of skill! %s + 1", TMCARD::TX_ATK)) end # 毎ターン攻撃力ï¼ï¼‘ if attacker.card.state & 4 != 0 && attacker.jp > 1 attacker.jp -= 1 add_message(sprintf("Reaction of skill! %s - 1", TMCARD::TX_ATK)) end end #-------------------------------------------------------------------------- # â—‹ タイプボーナスã®é©ç”¨ #-------------------------------------------------------------------------- def apply_type_bonus(attacker, target) if @type_bonus # å ´ã®ã‚¿ã‚¤ãƒ—ãƒœãƒ¼ãƒŠã‚¹ãŒæœ‰åй a = attacker.card.type b = target.card.type if (a == 0 && b == 2) || (a == 1 && b == 0) || (a == 2 && b == 1) || (a == 3 && b == 3) @damage += 1 add_message("Type bonus! Damage + 1", 7 + @turn) end end end #-------------------------------------------------------------------------- # â—‹ スã‚ル発動ãƒã‚§ãƒƒã‚¯ #-------------------------------------------------------------------------- def check_skill use_skill(@player[@turn].skill[3], @turn, 3) (0...3).each do |i| n = @player[@turn].lose - i use_skill(@player[@turn].skill[n], @turn, n) break if @player[@turn].card.state & 1 != 0 break if i == @player[@turn].lose end use_skill(@player[@turn ^ 1].skill[3], @turn ^ 1, 3) (0...3).each do |i| n = @player[@turn ^ 1].lose - i use_skill(@player[@turn ^ 1].skill[n], @turn ^ 1, n) break if @player[@turn ^ 1].card.state & 1 != 0 break if i == @player[@turn ^ 1].lose end end #-------------------------------------------------------------------------- # â—‹ 勿•—判定 #-------------------------------------------------------------------------- def judge_win_loss if game_end? @auto_flag = false # I beat the auto flag add_message("Yes game!") if @player[0].lose == 3 && @player[1].lose == 3 add_message("Draw") $game_variables[TMCARD::VN_RESULT] = 0 elsif @player[0].lose == 3 add_message(sprintf("Was defeated ...", @player[1].name)) $data_system.gameover_me.play $game_variables[TMCARD::VN_RESULT] = 1 else add_message(sprintf("%s Wins", @player[0].name)) $game_system.battle_end_me.play $game_variables[TMCARD::VN_RESULT] = 2 end end end #-------------------------------------------------------------------------- # â—‹ 決ç€ãŒç€ã„ã¦ã„ã‚‹ã‹ã‚’返㙠#-------------------------------------------------------------------------- def game_end? (@player[0].lose == 3 || @player[1].lose == 3) end #-------------------------------------------------------------------------- # â—‹ メッセージã®è¿½åŠ #-------------------------------------------------------------------------- def add_message(text, se = 0) @player[0].jp = [[@player[0].jp, 1].max, @jp_max].min @player[1].jp = [[@player[1].jp, 1].max, @jp_max].min @message.push([text, se, @player[0].hp, @player[0].jp, @player[1].hp, @player[1].jp]) end #-------------------------------------------------------------------------- # â—‹ ãŸã¾ã£ã¦ã„るメッセージを返㙠#-------------------------------------------------------------------------- def get_message @message.shift end #-------------------------------------------------------------------------- # â—‹ マップBGMã‚’æµã™ #-------------------------------------------------------------------------- def play_map_bgm @map_bgm.play @map_bgs.play end end #============================================================================== # â–¡ Scene_Card #============================================================================== class Scene_Card < Scene_Base #-------------------------------------------------------------------------- # â— é–‹å§‹å‡¦ç† #-------------------------------------------------------------------------- def start super create_background @spriteset = Spriteset_Card.new $game_duel.add_message(sprintf("Start play! %s Of bat first", $game_duel.active_player.name)) end #-------------------------------------------------------------------------- # â— çµ‚äº†å‡¦ç† #-------------------------------------------------------------------------- def terminate super $game_duel.play_map_bgm dispose_background @spriteset.dispose end #-------------------------------------------------------------------------- # â—‹ 背景ã®ä½œæˆ #-------------------------------------------------------------------------- def create_background @background_sprite = Sprite.new @background_sprite.bitmap = SceneManager.background_bitmap @background_sprite.color.set(16, 16, 16, 128) end #-------------------------------------------------------------------------- # â—‹ 背景ã®è§£æ”¾ #-------------------------------------------------------------------------- def dispose_background @background_sprite.dispose end #-------------------------------------------------------------------------- # ◠フレーム更新(基本) #-------------------------------------------------------------------------- def update_basic super @spriteset.update end #-------------------------------------------------------------------------- # â—‹ メッセージ表示ãŒçµ‚ã‚ã‚‹ã¾ã§ã‚¦ã‚§ã‚¤ãƒˆ #-------------------------------------------------------------------------- def wait_for_message i = 0 while(i < TMCARD::AUTO_WAIT) update_basic break if Input.trigger?(:C) || Input.trigger?(: if Input.trigger?(:A) # オートフラグ切替 Sound.play_ok $game_duel.auto_flag = !$game_duel.auto_flag break if $game_duel.auto_flag end i += 1 if $game_duel.auto_flag end end #-------------------------------------------------------------------------- # ◠フレーム更新 #-------------------------------------------------------------------------- def update $game_duel.update unless @spriteset.drawing? super update_message (0...2).each do |i| @spriteset.move_card(i) if $game_duel.player[i].refresh_move end end #-------------------------------------------------------------------------- # â—‹ ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã®æ›´æ–° #-------------------------------------------------------------------------- def update_message message = $game_duel.get_message while(message) # ãŸã¾ã£ã¦ã„るメッセージãŒãªããªã‚‹ã¾ã§ç¹°ã‚Šè¿”ã™ @spriteset.set_message(message[0]) case message[1] when 5,6 user = message[1] - 5 @spriteset.start_animation(user, $game_duel.player[user].lose, TMCARD::ANIME_SKILL) when 7,8 user = message[1] - 7 @spriteset.start_animation(user, $game_duel.player[user].lose, TMCARD::ANIME_BONUS) end $game_duel.player[0].hp_draw = message[2] $game_duel.player[0].jp_draw = message[3] $game_duel.player[1].hp_draw = message[4] $game_duel.player[1].jp_draw = message[5] wait_for_message @spriteset.set_message("") # 表示メッセージを空ã«ã™ã‚‹ message = $game_duel.get_message # 次ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã‚’å–å¾— end return_scene if $game_duel.game_end? # å‹è² ãŒã¤ã„ã¦ã„れã°ã‚²ãƒ¼ãƒ 終了 end end #============================================================================== # â– RPG::Item #============================================================================== class RPG::Item #-------------------------------------------------------------------------- # â—‹ カードã‹ã©ã†ã‹ã‚’返㙠#-------------------------------------------------------------------------- def card? /<(?:CARD|Card)>/i =~ @note ? true : false end #-------------------------------------------------------------------------- # â—‹ コストを返㙠#-------------------------------------------------------------------------- def c_cost /<(?:COST|Cost)\s*(\d+)\s*>/i =~ @note ? $1.to_i : 1 end #-------------------------------------------------------------------------- # â—‹ HPを返㙠#-------------------------------------------------------------------------- def c_hp /<(?:HP|HP)\s*(\d+)\s*>/i =~ @note ? $1.to_i : 1 end #-------------------------------------------------------------------------- # â—‹ 攻撃力を返㙠#-------------------------------------------------------------------------- def c_atk /<(?:ATK|Offensive power)\s*(\d+)\s*>/i =~ @note ? $1.to_i : 1 end #-------------------------------------------------------------------------- # â—‹ タイプ値を返㙠#-------------------------------------------------------------------------- def c_type /<(?:TYPE|Type)\s*(\d+)\s*>/i =~ @note ? $1.to_i : 0 end #-------------------------------------------------------------------------- # â—‹ 属性値を返㙠#-------------------------------------------------------------------------- def c_element /<(?:ELEMENT|Attribute)\s*(\d+)\s*>/i =~ @note ? $1.to_i : 0 end #-------------------------------------------------------------------------- # â—‹ レアリティ値を返㙠#-------------------------------------------------------------------------- def c_rare /<(?:RARE|Rare)\s*(\d+)\s*>/i =~ @note ? $1.to_i : 0 end #-------------------------------------------------------------------------- # â—‹ スã‚ルを返㙠#-------------------------------------------------------------------------- def c_skill(index) if index == 0 skill_id = /<Inheritance skill\s*(\d+)\s*>/ =~ @note ? $1.to_i : 1 else skill_id = /<Specific skills\s*(\d+)\s*>/ =~ @note ? $1.to_i : 1 end $data_skills[skill_id] end end #============================================================================== # â– RPG::Skill #============================================================================== class RPG::Skill #-------------------------------------------------------------------------- # â—‹ 発動ターンを返㙠#-------------------------------------------------------------------------- def c_turn /<The turn\s*(\d+)\s*>/ =~ @note ? $1.to_i : 0 end #-------------------------------------------------------------------------- # â—‹ 発動回数を返㙠#-------------------------------------------------------------------------- def c_repeats /<Trigger count\s*(\d+)\s*>/ =~ @note ? $1.to_i : 1 end end #============================================================================== # â– Window_MenuCommand #============================================================================== class Window_MenuCommand #-------------------------------------------------------------------------- # ◠独自コマンドã®è¿½åŠ ç”¨ #-------------------------------------------------------------------------- alias tmcard_window_menucommand_add_original_commands add_original_commands def add_original_commands tmcard_window_menucommand_add_original_commands if $game_switches[TMCARD::SW_USE_MENU_EDIT] add_command(TMCARD::DECK_EDIT, :deck_edit, true) end if $game_switches[TMCARD::SW_USE_MENU_TEST] add_command(TMCARD::DECK_TEST, :deck_test, true) end end end #============================================================================== # â–¡ Window_CardCommand #============================================================================== class Window_CardCommand < Window_Selectable #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, TMCARD::WIDTH_STATUS_WINDOW, line_height * TMCARD::DECK_MAX + 24) @index = 0 activate refresh end #-------------------------------------------------------------------------- # ◠決定やã‚ャンセルãªã©ã®ãƒãƒ³ãƒ‰ãƒªãƒ³ã‚°å‡¦ç† #-------------------------------------------------------------------------- def process_handling return unless open? && active super return process_description if handle?(:description) && Input.trigger?(:A) end #-------------------------------------------------------------------------- # â— ã‚ャンセル処ç†ã®æœ‰åŠ¹çŠ¶æ…‹ã‚’å–å¾— #-------------------------------------------------------------------------- def cancel_enabled? result = super && (SceneManager.scene_is?(Scene_DeckEdit) || $game_switches[TMCARD::SW_CAN_CANCEL]) Sound.play_buzzer unless result result end #-------------------------------------------------------------------------- # â—‹ èª¬æ˜Žãƒœã‚¿ãƒ³ãŒæŠ¼ã•れãŸã¨ãã®å‡¦ç† #-------------------------------------------------------------------------- def process_description Input.update call_handler(:description) end #-------------------------------------------------------------------------- # â— é …ç›®æ•°ã®å–å¾— #-------------------------------------------------------------------------- def item_max TMCARD::DECK_MAX end #-------------------------------------------------------------------------- # â— é¸æŠžé …ç›®ã®æœ‰åŠ¹çŠ¶æ…‹ã‚’å–å¾— #-------------------------------------------------------------------------- def current_item_enabled? return true if SceneManager.scene_is?(Scene_DeckEdit) return false if $game_party.deck(@index).include?(0) return false if SceneManager.scene_is?(Scene_DeckTest) && $game_party.deck($game_temp.card_enemy_index).include?(0) true end #-------------------------------------------------------------------------- # â— é …ç›®ã®æç”» #-------------------------------------------------------------------------- def draw_item(index) w = self.contents.width - 8 text = sprintf("Deck%s", TMCARD::DECK_LETTER[index]) self.contents.font.color = normal_color self.contents.draw_text(4, line_height * index, w, line_height, text) text = sprintf("%d/%d", $game_party.cost(index), $game_variables[TMCARD::VN_COST_MAX]) if $game_party.cost(index) == $game_variables[TMCARD::VN_COST_MAX] change_color(knockout_color) end self.contents.draw_text(4, line_height * index, w, line_height, text, 2) end end #============================================================================== # â–¡ Window_CardEquip #============================================================================== class Window_CardEquip < Window_Selectable #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize(x, y, start_index = 0) super(x, y, Graphics.width - x, line_height * 3 + 24) refresh(start_index) end #-------------------------------------------------------------------------- # ◠決定やã‚ャンセルãªã©ã®ãƒãƒ³ãƒ‰ãƒªãƒ³ã‚°å‡¦ç† #-------------------------------------------------------------------------- def process_handling return unless open? && active super return process_description if handle?(:description) && Input.trigger?(:A) end #-------------------------------------------------------------------------- # â—‹ èª¬æ˜Žãƒœã‚¿ãƒ³ãŒæŠ¼ã•れãŸã¨ãã®å‡¦ç† #-------------------------------------------------------------------------- def process_description Input.update call_handler(:description) end #-------------------------------------------------------------------------- # â— é …ç›®æ•°ã®å–å¾— #-------------------------------------------------------------------------- def item_max return 3 end #-------------------------------------------------------------------------- # â—‹ アイテムã®å–å¾— #-------------------------------------------------------------------------- def item @data[@index] end #-------------------------------------------------------------------------- # ◠リフレッシュ #-------------------------------------------------------------------------- def refresh(deck_index = 0) self.contents.clear @data = [] $game_party.cards(deck_index).each {|item| @data.push(item) } @item_max = @data.size self.contents.font.color = system_color self.contents.draw_text(4, line_height * 0, 48, line_height, "1:") self.contents.draw_text(4, line_height * 1, 48, line_height, "2:") self.contents.draw_text(4, line_height * 2, 48, line_height, "3:") self.contents.draw_text(4, line_height * 3, 48, line_height, "4:") self.contents.draw_text(4, line_height * 4, 48, line_height, "5:") self.contents.draw_text(4, line_height * 5, 48, line_height, "6:") self.contents.draw_text(4, line_height * 6, 48, line_height, "7:") self.contents.draw_text(4, line_height * 7, 48, line_height, "8:") self.contents.draw_text(4, line_height * 8, 48, line_height, "9:") self.contents.draw_text(4, line_height * 9, 48, line_height, "10:") self.contents.draw_text(4, line_height * 10, 48, line_height, "11:") self.contents.draw_text(4, line_height * 11, 48, line_height, "12:") self.contents.draw_text(4, line_height * 12, 48, line_height, "13:") self.contents.draw_text(4, line_height * 13, 48, line_height, "14:") self.contents.draw_text(4, line_height * 14, 48, line_height, "15:") self.contents.draw_text(4, line_height * 15, 48, line_height, "16:") self.contents.draw_text(4, line_height * 16, 48, line_height, "17:") self.contents.draw_text(4, line_height * 17, 48, line_height, "18:") self.contents.draw_text(4, line_height * 18, 48, line_height, "19:") self.contents.draw_text(4, line_height * 19, 48, line_height, "20:") self.contents.font.color = normal_color (0...3).each {|i| draw_item_name(@data[i], 48, line_height * i) } end end #============================================================================== # â–¡ Window_CardItem #============================================================================== class Window_CardItem < Window_Selectable #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize(x, y, equip_window, command_window) super(x, y, Graphics.width - x, Graphics.height - y) set_handler(:sort, method(:change_sort_type)) @equip_window = equip_window @command_window = command_window @sort_type = 0 refresh end #-------------------------------------------------------------------------- # â— é …ç›®æ•°ã®å–å¾— #-------------------------------------------------------------------------- def item_max n = 1 $game_party.items.each {|item| n += 1 if include?(item) } n end #-------------------------------------------------------------------------- # ◠決定やã‚ャンセルãªã©ã®ãƒãƒ³ãƒ‰ãƒªãƒ³ã‚°å‡¦ç† #-------------------------------------------------------------------------- def process_handling return unless open? && active super return process_description if handle?(:description) && Input.trigger?(:A) return process_sort if handle?(:sort) && Input.trigger?(:X) end #-------------------------------------------------------------------------- # â—‹ èª¬æ˜Žãƒœã‚¿ãƒ³ãŒæŠ¼ã•れãŸã¨ãã®å‡¦ç† #-------------------------------------------------------------------------- def process_description Input.update call_handler(:description) end #-------------------------------------------------------------------------- # â—‹ ã‚½ãƒ¼ãƒˆãƒœã‚¿ãƒ³ãŒæŠ¼ã•れãŸã¨ãã®å‡¦ç† #-------------------------------------------------------------------------- def process_sort Input.update call_handler(:sort) end #-------------------------------------------------------------------------- # â— é¸æŠžé …ç›®ã®æœ‰åŠ¹çŠ¶æ…‹ã‚’å–å¾— #-------------------------------------------------------------------------- def current_item_enabled? enable?(item) end #-------------------------------------------------------------------------- # â—‹ アイテムã®å–å¾— #-------------------------------------------------------------------------- def item $data_items[@data[@index]] end #-------------------------------------------------------------------------- # â—‹ アイテムをリストã«å«ã‚ã‚‹ã‹ã©ã†ã‹ # item : アイテム#-------------------------------------------------------------------------- def include?(item) return false unless item return false unless item.card? true end #-------------------------------------------------------------------------- # â—‹ アイテムを許å¯çŠ¶æ…‹ã§è¡¨ç¤ºã™ã‚‹ã‹ã©ã†ã‹ # item : アイテム#-------------------------------------------------------------------------- def enable?(item) return true unless item cost = $game_party.cost(@command_window.index) last_item = $game_party.cards(@command_window.index)[@equip_window.index] (cost - (last_item ? last_item.c_cost : 0) + item.c_cost <= $game_variables[TMCARD::VN_COST_MAX]) end #-------------------------------------------------------------------------- # ◠リフレッシュ #-------------------------------------------------------------------------- def refresh @data = [] $game_party.items.each {|item| @data.push(item.id) if include?(item) } sort @data.push(0) create_contents (0...item_max).each {|i| draw_item(i) } end #-------------------------------------------------------------------------- # â—‹ ソートタイプã®å¤‰æ›´ #-------------------------------------------------------------------------- def change_sort_type Sound.play_evasion @sort_type = (@sort_type + 1) % 6 refresh end #-------------------------------------------------------------------------- # â—‹ データソート #-------------------------------------------------------------------------- def sort return if @sort_type == 0 @data.sort! do |a, b| flag = false item_a = $data_items[a] item_b = $data_items[b] case @sort_type when 1; # Cost order item_a.c_cost <=> item_b.c_cost when 2; # Type order item_a.c_type <=> item_b.c_type when 3; # Attribute order item_a.c_element <=> item_b.c_element when 4; # HP order item_a.c_hp <=> item_b.c_hp when 5; # Attack order item_a.c_atk <=> item_b.c_atk end end end #-------------------------------------------------------------------------- # â—‹ é …ç›®ã®æç”» # index : é …ç›®ç•ªå· #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = $data_items[@data[index]] if item number = $game_party.item_number(item) enabled = enable?(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enabled) self.contents.draw_text(rect, sprintf(":%2d", number), 2) end end end #============================================================================== # â–¡ Window_CardStatus #============================================================================== class Window_CardStatus < Window_Base #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, TMCARD::WIDTH_STATUS_WINDOW, Graphics.height - y) hide @card = 0 end #-------------------------------------------------------------------------- # ◠解放 #-------------------------------------------------------------------------- def dispose super @card_sprite.dispose if @card_sprite end #-------------------------------------------------------------------------- # ◠フレーム更新 #-------------------------------------------------------------------------- def update super @card_sprite.visible = self.visible if @card_sprite end #-------------------------------------------------------------------------- # ◠リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear if @card_sprite @card_sprite.dispose @card_sprite = nil end return if @card == 0 card = Game_Card.new(@card) @card_sprite = Sprite_Card.new(card) @card_sprite.x = self.x + padding + self.contents.width / 2 - 64 @card_sprite.y = self.y + padding @card_sprite.z = self.z + 1 change_color(system_color) w = self.contents.width - 8 h = line_height self.contents.draw_text(4, 198, w, h, TMCARD::TX_COST) self.contents.draw_text(4, 222, w, h, TMCARD::TX_HP + "/" + TMCARD::TX_ATK) self.contents.draw_text(4, 246, w, h, TMCARD::TX_TYPE + "/" + TMCARD::TX_ELEMENT) self.contents.draw_text(4, 270, w, h, TMCARD::TX_SKILL) change_color(normal_color) self.contents.draw_text(4, 198, w, h, card.cost, 2) text = sprintf("%d / %d", card.hp, card.atk) self.contents.draw_text(4, 222, w, h, text, 2) text = TMCARD::TYPE_NAME[card.type] text += " / " + TMCARD::ELEMENT_NAME[card.element] self.contents.draw_text(4, 246, w, h, text, 2) self.contents.draw_text(4, 296, w, h, "★" + card.skill(0).name, 2) self.contents.draw_text(4, 320, w, h, "☆" + card.skill(1).name, 2) end #-------------------------------------------------------------------------- # â—‹ カード変更 #-------------------------------------------------------------------------- def set_new_card(id) if @card != id @card = id refresh end end end #============================================================================== # â–¡ Window_CardStatusEx #============================================================================== class Window_CardStatusEx < Window_Selectable #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, Graphics.width - x, Graphics.height - y) hide end #-------------------------------------------------------------------------- # ◠決定やã‚ャンセルãªã©ã®ãƒãƒ³ãƒ‰ãƒªãƒ³ã‚°å‡¦ç† #-------------------------------------------------------------------------- def process_handling return unless open? && active super return process_description if handle?(:description) && Input.trigger?(:A) end #-------------------------------------------------------------------------- # â—‹ èª¬æ˜Žãƒœã‚¿ãƒ³ãŒæŠ¼ã•れãŸã¨ãã®å‡¦ç† #-------------------------------------------------------------------------- def process_description Input.update Sound.play_ok call_handler(:description) end #-------------------------------------------------------------------------- # ◠リフレッシュ #-------------------------------------------------------------------------- def refresh(card) self.contents.clear draw_horz_line(224, line_height * 2) draw_horz_line(0, line_height * 8) change_color(system_color) self.contents.draw_text(224, line_height * 0, 64, line_height, TMCARD::TX_NAME) self.contents.draw_text(224, line_height * 1, 64, line_height, TMCARD::TX_RARE) self.contents.draw_text(224, line_height * 3, 128, line_height, TMCARD::TX_COST) self.contents.draw_text(224, line_height * 4, 128, line_height, TMCARD::TX_HP) self.contents.draw_text(224, line_height * 5, 128, line_height, TMCARD::TX_ATK) self.contents.draw_text(224, line_height * 6, 128, line_height, TMCARD::TX_TYPE) self.contents.draw_text(224, line_height * 7, 128, line_height, TMCARD::TX_ELEMENT) self.contents.draw_text(4, line_height * 9, 364, line_height, TMCARD::TX_SKILL) change_color(normal_color) self.contents.draw_text(288, line_height * 0, 192, line_height, card.name, 2) text = TMCARD::RARE_NAME[card.c_rare] self.contents.draw_text(288, line_height * 1, 192, line_height, text, 2) self.contents.draw_text(224, line_height * 3, 128, line_height, card.c_cost, 2) self.contents.draw_text(224, line_height * 4, 128, line_height, card.c_hp, 2) self.contents.draw_text(224, line_height * 5, 128, line_height, card.c_atk, 2) text = TMCARD::TYPE_NAME[card.c_type] self.contents.draw_text(224, line_height * 6, 128, line_height, text, 2) text = TMCARD::ELEMENT_NAME[card.c_element] self.contents.draw_text(224, line_height * 7, 128, line_height, text, 2) w = self.contents.width - 16 skill = card.c_skill(0) self.contents.draw_text(4, line_height * 10, w, line_height, "★" + skill.name) self.contents.draw_text(16, line_height * 11, w, line_height, skill.description) skill = card.c_skill(1) self.contents.draw_text(4, line_height * 12, w, line_height, "☆" + skill.name) self.contents.draw_text(16, line_height * 13, w, line_height, skill.description) end #-------------------------------------------------------------------------- # â— æ°´å¹³ç·šã®æç”» #-------------------------------------------------------------------------- def draw_horz_line(x, y) line_y = y + line_height / 2 - 1 contents.fill_rect(x, line_y, contents_width, 2, line_color) end #-------------------------------------------------------------------------- # ◠水平線ã®è‰²ã‚’å–å¾— #-------------------------------------------------------------------------- def line_color color = normal_color color.alpha = 48 color end end #============================================================================== # â– Scene_Menu #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # ◠コマンドウィンドウã®ä½œæˆ #-------------------------------------------------------------------------- alias tmcard_scene_menu_create_command_window create_command_window def create_command_window tmcard_scene_menu_create_command_window @command_window.set_handler(:deck_edit, method(:command_deck_edit)) @command_window.set_handler(:deck_test, method(:command_deck_test)) end #-------------------------------------------------------------------------- # â—‹ コマンド[デッã‚編集] #-------------------------------------------------------------------------- def command_deck_edit SceneManager.call(Scene_DeckEdit) end #-------------------------------------------------------------------------- # â—‹ コマンド[模擬デュエル] #-------------------------------------------------------------------------- def command_deck_test SceneManager.call(Scene_DeckTest) end end #============================================================================== # â–¡ Scene_DeckEdit #============================================================================== class Scene_DeckEdit < Scene_MenuBase #-------------------------------------------------------------------------- # â— é–‹å§‹å‡¦ç† #-------------------------------------------------------------------------- def start super @help_window = Window_Help.new(1) @status_window = Window_CardStatus.new(0, @help_window.height) @equip_window = Window_CardEquip.new(@status_window.width, @help_window.height) @equip_window.set_handler(:ok, method(:on_equip_ok)) @equip_window.set_handler(:cancel, method(:on_equip_cancel)) @equip_window.set_handler(:description, method(:open_status_ex)) @command_window = Window_CardCommand.new(0, @help_window.height) @command_window.set_handler(:ok, method(:on_command_ok)) @command_window.set_handler(:cancel, method(:return_scene)) @item_window = Window_CardItem.new(@status_window.width, @equip_window.y + @equip_window.height, @equip_window, @command_window) @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @item_window.set_handler(:description, method(:open_status_ex)) @status_ex_window = Window_CardStatusEx.new(0, @help_window.height) @status_ex_window.set_handler(:ok, method(:close_status_ex)) @status_ex_window.set_handler(:cancel, method(:close_status_ex)) @status_ex_window.set_handler(:description, method(:close_status_ex)) @help_window.set_text("Please select the deck you want to edit") end #-------------------------------------------------------------------------- # ◠フレーム更新 #-------------------------------------------------------------------------- def update last_command_index = @command_window.index last_equip_index = @equip_window.index super unless @status_ex_window.visible update_status_window if @command_window.active if last_command_index != @command_window.index @equip_window.refresh(@command_window.index) end elsif @equip_window.active @item_window.refresh if last_equip_index != @equip_window.index end end end #-------------------------------------------------------------------------- # â—‹ ã‚¹ãƒ†ãƒ¼ã‚¿ã‚¹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®æ›´æ–° #-------------------------------------------------------------------------- def update_status_window if @equip_window.active deck = $game_party.deck(@command_window.index) @status_window.set_new_card(deck[@equip_window.index]) elsif @item_window.active id = @item_window.item ? @item_window.item.id : 0 @status_window.set_new_card(id) end end #-------------------------------------------------------------------------- # â—‹ コマンド[決定] #-------------------------------------------------------------------------- def on_command_ok @command_window.hide @status_window.show @equip_window.activate @equip_window.select(0) text = sprintf("Deck%s Total cost %d / %d", TMCARD::DECK_LETTER[@command_window.index], $game_party.cost(@command_window.index), $game_variables[TMCARD::VN_COST_MAX]) @help_window.set_text(text) end #-------------------------------------------------------------------------- # â—‹ 装備部ä½é¸æŠžï¼»æ±ºå®šï¼½ #-------------------------------------------------------------------------- def on_equip_ok @item_window.select(0) @item_window.activate end #-------------------------------------------------------------------------- # â—‹ 装備部ä½é¸æŠžï¼»ã‚ャンセル] #-------------------------------------------------------------------------- def on_equip_cancel @command_window.show.activate @status_window.hide @equip_window.index = -1 @help_window.set_text("Please select the deck you want to edit") end #-------------------------------------------------------------------------- # â—‹ ã‚¢ã‚¤ãƒ†ãƒ é¸æŠžï¼»æ±ºå®šï¼½ #-------------------------------------------------------------------------- def on_item_ok item = @item_window.item Sound.play_equip $game_party.change_card(@command_window.index, @equip_window.index, item) @equip_window.activate @equip_window.refresh(@command_window.index) @item_window.refresh @item_window.unselect @command_window.refresh text = sprintf("Deck%s Total cost %d / %d", TMCARD::DECK_LETTER[@command_window.index], $game_party.cost(@command_window.index), $game_variables[TMCARD::VN_COST_MAX]) @help_window.set_text(text) end #-------------------------------------------------------------------------- # â—‹ ã‚¢ã‚¤ãƒ†ãƒ é¸æŠžï¼»ã‚ャンセル] #-------------------------------------------------------------------------- def on_item_cancel @equip_window.activate @item_window.index = -1 end #-------------------------------------------------------------------------- # â—‹ ステータスEXウィンドウを開ã #-------------------------------------------------------------------------- def open_status_ex if @equip_window.active item = $game_party.cards(@command_window.index)[@equip_window.index] else item = @item_window.item end if item Sound.play_ok @status_ex_window.refresh(item) @status_ex_window.show.activate @status_window.x = Graphics.width @equip_window.hide.deactivate @item_window.hide.deactivate else Sound.play_buzzer end end #-------------------------------------------------------------------------- # â—‹ ステータスEXウィンドウを閉ã˜ã‚‹ #-------------------------------------------------------------------------- def close_status_ex @status_ex_window.hide @status_window.x = 0 @equip_window.show @item_window.show (@item_window.index == -1 ? @equip_window : @item_window).activate end end #============================================================================== # â– Game_Temp #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ◠公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :card_enemy_deck # 対戦相手ã®ãƒ‡ãƒƒã‚ attr_accessor :card_enemy_name # 対戦相手ã®åå‰ attr_accessor :card_enemy_index # 模擬デュエル相手ã®ãƒ‡ãƒƒã‚ #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- alias tmcard_game_temp_initialize initialize def initialize tmcard_game_temp_initialize @card_enemy_deck = [] @card_enemy_name = "" @card_enemy_index = 1 end end #============================================================================== # â–¡ Window_CardEnemy #============================================================================== class Window_CardEnemy < Window_Selectable #-------------------------------------------------------------------------- # â— ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆåˆæœŸåŒ– #-------------------------------------------------------------------------- def initialize(enemy) super(0, 0, Graphics.width - TMCARD::WIDTH_STATUS_WINDOW, line_height * 3 + 24) @enemy = enemy refresh end #-------------------------------------------------------------------------- # â— é …ç›®æ•°ã®å–å¾— #-------------------------------------------------------------------------- def item_max return 3 end #-------------------------------------------------------------------------- # â—‹ アイテムã®å–å¾— #-------------------------------------------------------------------------- def item @data[self.index] end #-------------------------------------------------------------------------- # ◠リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear @data = [] @enemy.each {|id| @data.push($data_items[id]) } change_color(system_color) self.contents.draw_text(4, line_height * 0, 48, line_height, "敵1") self.contents.draw_text(4, line_height * 1, 48, line_height, "敵2") self.contents.draw_text(4, line_height * 2, 48, line_height, "敵3") change_color(normal_color) (0...3).each {|i| draw_item_name(@data[i], 48, line_height * i) } end end #============================================================================== # â–¡ Scene_DeckSelect #============================================================================== class Scene_DeckSelect < Scene_MenuBase #-------------------------------------------------------------------------- # â— é–‹å§‹å‡¦ç† #-------------------------------------------------------------------------- def start super @help_window = Window_Help.new(1) @help_window.set_text("使用ã™ã‚‹ãƒ‡ãƒƒã‚ã‚’é¸æŠžã—ã¦ãã ã•ã„") @command_window = Window_CardCommand.new(0, @help_window.height) @command_window.set_handler(:ok, method(:on_command_ok)) @command_window.set_handler(:cancel, method(:return_scene)) @equip_window = Window_CardEquip.new(@command_window.width, @help_window.height) create_enemy_window setup_window_position end #-------------------------------------------------------------------------- # â—‹ 対戦相手ã®ãƒ‡ãƒƒã‚ウィンドウを作æˆã™ã‚‹ #-------------------------------------------------------------------------- def create_enemy_window $game_variables[TMCARD::VN_RESULT] = 3 # çµæžœå¤‰æ•°ã®åˆæœŸåŒ– @enemy_deck = $game_temp.card_enemy_deck @enemy_name = $game_temp.card_enemy_name @enemy_window = Window_CardEnemy.new(@enemy_deck) end #-------------------------------------------------------------------------- # â—‹ ウィンドウã®ä½ç½®ã‚’調整ã™ã‚‹ #-------------------------------------------------------------------------- def setup_window_position if @command_window.height + @help_window.height <= (Graphics.height - @enemy_window.height) x = (Graphics.width - @enemy_window.width) / 2 if @command_window.height > @equip_window.height y = @help_window.height + @command_window.height else y = @help_window.height + @equip_window.height end else x = @command_window.width y = @help_window.height + @equip_window.height end @enemy_window.x = x @enemy_window.y = (Graphics.height - y - @enemy_window.height) / 2 + y end #-------------------------------------------------------------------------- # â—‹ コマンド[決定] #-------------------------------------------------------------------------- def on_command_ok $game_party.set_active_deck(@command_window.index) $game_duel = Game_Duel.new unless $game_duel $game_duel.setup(@enemy_deck, @enemy_name) SceneManager.goto(Scene_Card) end #-------------------------------------------------------------------------- # ◠フレーム更新 #-------------------------------------------------------------------------- def update last_command_index = @command_window.index super if last_command_index != @command_window.index @equip_window.refresh(@command_window.index) end end end #============================================================================== # â–¡ Scene_DeckTest #============================================================================== class Scene_DeckTest < Scene_DeckSelect #-------------------------------------------------------------------------- # â—‹ 対戦相手ã®ãƒ‡ãƒƒã‚ウィンドウを作æˆã™ã‚‹ #-------------------------------------------------------------------------- def create_enemy_window @command_window.set_handler(:description, method(:set_enemy_deck)) $game_temp.card_enemy_index = 1 @enemy_window = Window_CardEquip.new(@command_window.width, 0, 1) end #-------------------------------------------------------------------------- # â—‹ コマンド[決定] #-------------------------------------------------------------------------- def on_command_ok $game_party.set_active_deck(@command_window.index) $game_duel = Game_Duel.new unless $game_duel $game_duel.setup($game_party.deck($game_temp.card_enemy_index), "デッã‚" + TMCARD::DECK_LETTER[$game_temp.card_enemy_index]) SceneManager.goto(Scene_Card) end #-------------------------------------------------------------------------- # â—‹ å¯¾æˆ¦ç›¸æ‰‹ã®æ±ºå®š #-------------------------------------------------------------------------- def set_enemy_deck if $game_party.deck(@command_window.index).include?(0) Sound.play_buzzer else Sound.play_ok $game_temp.card_enemy_index = @command_window.index @enemy_window.refresh($game_temp.card_enemy_index) end @command_window.activate end end #============================================================================== # â–¡ Game_Duel #============================================================================== class Game_Duel #-------------------------------------------------------------------------- # â—‹ スã‚ル使用 #-------------------------------------------------------------------------- def use_skill(skill, user, card) return unless skill # スã‚ルãŒãªã‘れã°çµ‚了 return unless conditions_met?(skill, user, card) # 発動æ¡ä»¶åˆ¤å®š if /<効果\s*(\d+)\s*\,\s*(\-*\d+)\s*>/ =~ skill.note id = $1.to_i param = $2.to_i end enemy = user ^ 1 p_name = @player[user].card.name e_name = @player[enemy].card.name case id when 1 # 相手ã«ä¸Žãˆã‚‹ãƒ€ãƒ¡ãƒ¼ã‚¸ï¼‹â—‹â—‹ @damage = [@damage + param, 0].max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("与ãˆã‚‹ãƒ€ãƒ¡ãƒ¼ã‚¸ %s %d", param < 0 ? "-" : "+", param.abs)) when 2 # 相手ã«ä¸Žãˆã‚‹ãƒ€ãƒ¡ãƒ¼ã‚¸ãŒï¼’å€ã«ãªã‚‹ @damage *= 2 add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message("与ãˆã‚‹ãƒ€ãƒ¡ãƒ¼ã‚¸ 2 å€") when 3 # 相手ã‹ã‚‰å—ã‘るダメージ+○○ @damage = [@damage + param, 0].max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("å—ã‘るダメージ %s %d", param < 0 ? "-" : "+", param.abs)) when 4 # 相手ã‹ã‚‰å—ã‘るダメージãŒåŠåˆ†ã«ãªã‚‹ @damage /= 2 add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message("å—ã‘るダメージ åŠåˆ†") when 5 # 相手ã®ç¶™æ‰¿ã‚¹ã‚ルを無効化 @player[enemy].card.add_state(1) add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®ç¶™æ‰¿ã‚¹ã‚ルを無効化", e_name)) when 6 # ç›¸æ‰‹ã®æ”»æ’ƒã‚’スルー @phase = 2 add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message("ç›¸æ‰‹ã®æ”»æ’ƒã‚’無視") when 7 # 自分ã®ï¼¨ï¼°ï¼‹â—‹â—‹ @player[user].hp = [@player[user].hp + param, 0].max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s %s %d", TMCARD::TX_HP, param < 0 ? "-" : "+", param.abs)) when 8 # è‡ªåˆ†ã®æ”»æ’ƒåŠ›ï¼‹â—‹â—‹ @player[user].jp += param add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s %s %d", TMCARD::TX_ATK, param < 0 ? "-" : "+", param.abs)) when 9 # è‡ªåˆ†ã®æ”»æ’ƒåŠ›ã‚’â—‹â—‹ã«ã™ã‚‹ @player[user].jp = param add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ㌠%d ã«ãªã£ãŸ", TMCARD::TX_ATK, param)) when 10 # 相手ã®ï¼¨ï¼°ï¼‹â—‹â—‹ @player[enemy].hp = [@player[enemy].hp + param, 0].max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®%s %s %d", e_name, TMCARD::TX_HP, param < 0 ? "-" : "+", param.abs)) when 11 # ç›¸æ‰‹ã®æ”»æ’ƒåŠ›ï¼‹â—‹â—‹ @player[enemy].jp += param add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®%s %s %d", e_name, TMCARD::TX_ATK, param < 0 ? "-" : "+", param.abs)) when 12 # ç›¸æ‰‹ã®æ”»æ’ƒåŠ›ã‚’â—‹â—‹ã«ã™ã‚‹ @player[enemy].jp = param add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®%s㌠%d ã«ãªã£ãŸ", e_name, TMCARD::TX_ATK, param)) when 13 # â—‹â—‹ã®æ”»æ’ƒåŠ›ã‚’æœ€å¤§ã«ã™ã‚‹ï¼ˆ1 = 自分 / 2 = 相手) if param == 1 @player[user].jp = @jp_max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®%s㌠最大 ã«ãªã£ãŸ", p_name, TMCARD::TX_ATK)) else @player[enemy].jp = @jp_max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®%s㌠最大 ã«ãªã£ãŸ", e_name, TMCARD::TX_ATK)) end when 14 # 自分ã®ï¼¨ï¼°ï¼â—‹â—‹ã€ä¸Žãˆã‚‹ãƒ€ãƒ¡ãƒ¼ã‚¸ï¼‹â—‹â—‹ @damage = [@damage + param, 0].max @player[user].hp = [@player[user].hp - param, 0].max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("与ãˆã‚‹ãƒ€ãƒ¡ãƒ¼ã‚¸ %s %d / %s %s %d", param < 0 ? "-" : "+", param.abs, TMCARD::TX_HP, param < 0 ? "+" : "-", param.abs)) when 15 # 自分ã¨ç›¸æ‰‹ã®â—‹â—‹ã‚’入れ替ãˆã‚‹ï¼ˆ1 = HP / 2 = 攻撃力) if param == 1 @player[user].hp, @player[enemy].hp = @player[enemy].hp, @player[user].hp add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s入れ替ãˆ", TMCARD::TX_HP)) else @player[user].jp, @player[enemy].jp = @player[enemy].jp, @player[user].jp add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s入れ替ãˆ", TMCARD::TX_ATK)) end when 16 # 自分ã¨ç›¸æ‰‹ã®â—‹â—‹ã‚’å¹³å‡åŒ–(1 = HP / 2 = 攻撃力) if param == 1 n = (@player[user].hp + @player[enemy].hp) / 2 @player[user].hp = @player[enemy].hp = n add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%så¹³å‡å€¤", TMCARD::TX_HP)) else n = (@player[user].jp + @player[enemy].jp) / 2 @player[user].jp = @player[enemy].jp = n add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%så¹³å‡å€¤", TMCARD::TX_ATK)) end when 17 # 相手ã«â—‹â—‹ã®ãƒ€ãƒ¡ãƒ¼ã‚¸ @player[enemy].hp = [@player[enemy].hp - param, 0].max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã« %d ダメージ", e_name, param)) when 18 # 自分ã¨ç›¸æ‰‹ã«â—‹â—‹ã®ãƒ€ãƒ¡ãƒ¼ã‚¸ @player[user].hp = [@player[user].hp - param, 0].max @player[enemy].hp = [@player[enemy].hp - param, 0].max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s 㨠%s ã« %d ダメージ", p_name, e_name, param)) when 20 # 自分ã®ç¶™æ‰¿ã‚¹ã‚ルを相手ã¨åŒã˜ã«ã™ã‚‹ @player[user].skill[card] = @player[enemy].skill[@player[enemy].lose] add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("相手ã®ç¶™æ‰¿%sをコピー", TMCARD::TX_SKILL)) when 21 # 相手ã®ç¶™æ‰¿ã‚¹ã‚ルを奪ㆠ@player[user].skill[card] = @player[enemy].skill[@player[enemy].lose] @player[enemy].skill[@player[enemy].lose] = nil add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("相手ã®ç¶™æ‰¿%sを奪ã£ãŸ", TMCARD::TX_SKILL)) when 22 # 相手ã®ç¶™æ‰¿ã‚¹ã‚ルを○○ã«ã™ã‚Šã‹ãˆã‚‹ @player[enemy].skill[@player[enemy].lose] = $data_skills[param] add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s 㮠継承%s㌠%s ã«ãªã£ãŸ", e_name, TMCARD::TX_SKILL, $data_skills[param].name)) when 23 # 相手ã®å›ºæœ‰ã‚¹ã‚ルを○○ã«ã™ã‚Šã‹ãˆã‚‹ @player[enemy].skill[3] = $data_skills[param] add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s 㮠固有%s㌠%s ã«ãªã£ãŸ", e_name, TMCARD::TX_SKILL, $data_skills[param].name)) when 24 # 使用済ã¿ã‚¹ã‚ルãŒå¾©æ´»ã™ã‚‹ (0..3).each {|i| @player[user].skill_cnt[i] = 0 } add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã® %sãŒå¾©æ´»", p_name, TMCARD::TX_SKILL)) when 25 # 以é™ã®ã‚¿ã‚¤ãƒ—ボーナスを無効化 @type_bonus = false add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message("以é™ã®ã‚¿ã‚¤ãƒ—ボーナス無効") when 26 # 以é™ã®æ”»æ’ƒåŠ›ä¸Šé™ã‚’â—‹â—‹ã«ã™ã‚‹ @jp_max = param add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s上é™ãŒ %d ã«å¤‰æ›´", TMCARD::TX_ATK, param)) when 27 # 以é™ã®æ”»æ’ƒåŠ›ä¸Šé™ï¼‹â—‹â—‹ @jp_max = [@jp_max + param, 1].max add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%sä¸Šé™ %s %d", TMCARD::TX_ATK, param < 0 ? "-" : "+", param.abs)) when 28 # è‡ªåˆ†ã®æ”»æ’ƒåŠ›ã‚’ä»¥é™ã®æ”»æ’ƒåŠ›ä¸Šé™ã«ã™ã‚‹ @jp_max = @player[user].jp add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s上é™ãŒ %d ã«å¤‰æ›´", TMCARD::TX_ATK, @jp_max)) when 29 # 攻撃力を1ã«ã™ã‚‹ãŒã€æ¯Žã‚¿ãƒ¼ãƒ³æ”»æ’ƒåŠ›ï¼‹ï¼‘ï¼ˆ1 = 自分 / 2 = 相手) if param == 1 @player[user].jp = 1 @player[user].card.add_state(2) add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®%s㌠1 ã«ãªã£ãŸ", p_name, TMCARD::TX_ATK)) else @player[enemy].jp = 1 @player[enemy].card.add_state(2) add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®%s㌠1 ã«ãªã£ãŸ", e_name, TMCARD::TX_ATK)) end when 30 # 攻撃力を最大ã«ã™ã‚‹ãŒã€æ¯Žã‚¿ãƒ¼ãƒ³æ”»æ’ƒåŠ›ï¼ï¼‘(1 = 自分 / 2 = 相手) if param == 1 @player[user].jp = @jp_max @player[user].card.add_state(4) add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®%s㌠最大 ã«ãªã£ãŸ", p_name, TMCARD::TX_ATK)) else @player[enemy].jp = @jp_max @player[enemy].card.add_state(4) add_message(sprintf("%s ã® %s 発動!!", p_name, skill.name), 5 + user) add_message(sprintf("%s ã®%s㌠最大 ã«ãªã£ãŸ", e_name, TMCARD::TX_ATK)) end end @player[user].skill_cnt[card] += 1 # スã‚ãƒ«ç™ºå‹•å›žæ•°åŠ ç®— @player[user].used_skill[card] = true # スã‚ル発動済ã¿ãƒ•ラグを立ã¦ã‚‹ end #-------------------------------------------------------------------------- # â—‹ 発動æ¡ä»¶ãƒã‚§ãƒƒã‚¯ #-------------------------------------------------------------------------- def conditions_met?(skill, user, card) return false unless effect_conditions_met?(skill, user) unless skill.c_repeats == 0 || @player[user].skill_cnt[card] < skill.c_repeats return false # ç™ºå‹•å›žæ•°åˆ¶é™ end unless skill.c_turn == 0 || @player[user].card.turn == skill.c_turn return false # ç™ºå‹•ã‚¿ãƒ¼ãƒ³åˆ¶é™ end return false if @player[user].used_skill[card] # åŒã‚¿ãƒ¼ãƒ³å†…ç™ºå‹•åˆ¶é™ enemy = user ^ 1 skill.note.each_line do |line| if /<æ¡ä»¶\s*(\d+)\s*\,\s*(\d+)\s*>/ =~ line param = $2.to_i case $1.to_i when 2 # 相手ãŒâ—‹â—‹ã‚¿ã‚¤ãƒ— return false unless @player[enemy].type == param when 3 # 相手ãŒâ—‹â—‹å±žæ€§ return false unless @player[enemy].element == param when 4 # 相手ã®ãƒ¬ã‚¢ãƒªãƒ†ã‚£ãŒâ—‹â—‹ return false unless @player[enemy].rare == param when 5 # 相手ã®ãƒã‚¸ã‚·ãƒ§ãƒ³ãŒâ—‹â—‹ return false unless @player[enemy].lose == param when 6 # 相手ã®ï¼¨ï¼°ãŒâ—‹â—‹ä»¥ä¸Š return false unless @player[enemy].hp >= param when 7 # 相手ã®ï¼¨ï¼°ãŒâ—‹â—‹ä»¥ä¸‹ return false unless @player[enemy].hp <= param && @player[enemy].hp > 0 when 8 # 相手ã®ï¼¨ï¼°ãŒâ—‹â—‹ã«ãªã£ãŸ return false unless @player[enemy].hp == param when 9 # 相手ã®ï¼¨ï¼°ãŒâ—‹â—‹ï¼ˆ0 = å¶æ•° / 1 = 奇数) return false unless @player[enemy].hp % 2 == param when 10 # ç›¸æ‰‹ã®æ”»æ’ƒåŠ›ãŒâ—‹â—‹ä»¥ä¸Š return false unless @player[enemy].jp >= param when 11 # ç›¸æ‰‹ã®æ”»æ’ƒåŠ›ãŒâ—‹â—‹ä»¥ä¸‹ return false unless @player[enemy].jp <= param when 12 # ç›¸æ‰‹ã®æ”»æ’ƒåŠ›ãŒâ—‹â—‹ã«ãªã£ãŸ return false unless @player[enemy].jp == param when 13 # ç›¸æ‰‹ã®æ”»æ’ƒåŠ›ãŒâ—‹â—‹ï¼ˆ1 = 奇数 / 2 = å¶æ•°ï¼‰ return false unless @player[enemy].jp % 2 == param when 14 # 自分ãŒâ—‹â—‹ã‚¿ã‚¤ãƒ— return false unless @player[user].type == param when 15 # 自分ãŒâ—‹â—‹å±žæ€§ return false unless @player[user].element == param when 16 # 自分ã®ãƒ¬ã‚¢ãƒªãƒ†ã‚£ãŒâ—‹â—‹ return false unless @player[user].rare == param when 17 # 自分ã®ãƒã‚¸ã‚·ãƒ§ãƒ³ãŒâ—‹â—‹ return false unless @player[user].lose == param when 18 # 自分ã®ï¼¨ï¼°ãŒâ—‹â—‹ä»¥ä¸Š return false unless @player[user].hp >= param when 19 # 自分ã®ï¼¨ï¼°ãŒâ—‹â—‹ä»¥ä¸‹ return false unless @player[user].hp <= param && @player[user].hp > 0 when 20 # 自分ã®ï¼¨ï¼°ãŒâ—‹â—‹ã«ãªã£ãŸ return false unless @player[user].hp == param when 21 # 自分ã®ï¼¨ï¼°ãŒâ—‹â—‹ï¼ˆ1 = 奇数 / 2 = å¶æ•°ï¼‰ return false unless @player[user].hp % 2 == param when 22 # è‡ªåˆ†ã®æ”»æ’ƒåŠ›ãŒâ—‹â—‹ä»¥ä¸Š return false unless @player[user].jp >= param when 23 # è‡ªåˆ†ã®æ”»æ’ƒåŠ›ãŒâ—‹â—‹ä»¥ä¸‹ return false unless @player[user].jp <= param when 24 # è‡ªåˆ†ã®æ”»æ’ƒåŠ›ãŒâ—‹â—‹ã«ãªã£ãŸ return false unless @player[user].jp == param when 25 # è‡ªåˆ†ã®æ”»æ’ƒåŠ›ãŒâ—‹â—‹ï¼ˆ1 = 奇数 / 2 = å¶æ•°ï¼‰ return false unless @player[user].jp % 2 == param when 26 # 攻撃ã•れãŸã¨ã return false unless @turn == enemy && @phase == 2 when 27 # 攻撃ã—ãŸã¨ã return false unless @turn == user && @phase == 2 when 28 # 自分ãŒâ—‹â—‹ã‚’継承ã—ã¦ã„ã‚‹ flag = false (0..card).each do |i| flag = true if @player[user].skill[i].id == param end return false unless flag when 29 # 自分ã®ã‚³ã‚¹ãƒˆãŒç›¸æ‰‹ã‚ˆã‚Šä½Žã„ return false unless @player[user].cost < @player[enemy].cost when 30 # 自分ã®ã‚³ã‚¹ãƒˆãŒç›¸æ‰‹ã‚ˆã‚Šé«˜ã„ return false unless @player[user].cost > @player[enemy].cost when 31 # 自デッã‚ã®ã‚¿ã‚¤ãƒ—ãŒçµ±ä¸€ã•れã¦ã„ã‚‹ unless @player[user].type(0) == @player[user].type(1) && @player[user].type(1) == @player[user].type(2) return false end when 32 # 自デッã‚ã®å±žæ€§ãŒçµ±ä¸€ã•れã¦ã„ã‚‹ unless @player[user].element(0) == @player[user].element(1) && @player[user].element(1) == @player[user].element(2) return false end when 33 # 自デッã‚ã®ã‚³ã‚¹ãƒˆãŒâ—‹â—‹ä»¥ä¸Š unless @player[user].cost(0) + @player[user].cost(1) + @player[user].cost(2) >= param return false end when 34 # 自デッã‚ã®ã‚³ã‚¹ãƒˆãŒâ—‹â—‹ä»¥ä¸‹ unless @player[user].cost(0) + @player[user].cost(1) + @player[user].cost(2) <= param return false end end end end true end #-------------------------------------------------------------------------- # â—‹ スã‚ル効果ã®å›ºå®šæ¡ä»¶åˆ¤å®š #-------------------------------------------------------------------------- def effect_conditions_met?(skill, user) if /<効果\s*(\d+)\s*\,\s*(\-*\d+)\s*>/ =~ skill.note effect_id = $1.to_i effect_param = $2.to_i else return false # 効果ãŒè¨å®šã•れã¦ã„ãªã„ end enemy = user ^ 1 case effect_id when 1, 2, 14 (@turn == user && @phase == 1) # 自ターンã®è¨ˆç®—フェイズ when 3, 4 (@turn == enemy && @phase == 1) # 相手ターンã®è¨ˆç®—フェイズ when 17, 18 (@turn == user && @phase == 0) # è‡ªã‚¿ãƒ¼ãƒ³ã®æº–備フェイズ when 6 (@turn == enemy && @phase == 0) # ç›¸æ‰‹ã‚¿ãƒ¼ãƒ³ã®æº–備フェイズ when 19 (@phase == 2) # åŒæ–¹ã®ã‚¿ãƒ¼ãƒ³ã®æ”»æ’ƒãƒ•ェイズ else true end end end the scripts are traslated by me with google traslator bcs they were in japanese. this is the link of the demo: Click Here i found the demo on this site hikimoki.sakura.ne.jp if u know any scripts to make a card game like YU-GI-OH can y link it? thanks Share this post Link to post Share on other sites
Pikalyze 4 Posted June 27, 2013 Well, before I even start, I tried using this system one time. Very easy to work with, just very, very dull to start making the cards :3. Also, it's in Japanese, and Google Translate isn't exactly perfect(They translate the word for battler from japanese into the english 'butler'.) Anyways, what your asking is not a question. It's more of a request. You should post this into script request forums if you'd like someone to attempt to do it for you. Secondly, some of the features are already within the system, you just have to work with it. Anyways, I tried looking, but there are no current scripts that do anything of what you need, since this is a completely different concept of a system, since mostly people make battle-addons or their own standalone scripts. To change the maximum, you can edit the GUI(Window) up a bit, and make it display the list. It would require some work, but that's what we're all doing while developing games, right? As for the rest, I don't know. Just remember, it's really, Really hard to find addons/edits of stuff like this, because of how different it is from the addons people make for battle systems. Share this post Link to post Share on other sites