/// <summary> /// Frame Update (when target window is active) /// </summary> void UpdateTarget() { // If B button was pressed if (Input.RMTrigger.B) { // Play cancel SE InGame.System.SoundPlay(Data.System.CancelSoundEffect); // If unable to use because items ran out if (!InGame.Party.IsItemCanUse(item.Id)) { // Remake item window contents itemWindow.Refresh(); } // Erase target window itemWindow.IsActive = true; targetWindow.IsVisible = false; targetWindow.IsActive = false; return; } // If C button was pressed if (Input.RMTrigger.C) { // If items are used up if (InGame.Party.ItemNumber(item.Id) == 0) { // Play buzzer SE InGame.System.SoundPlay(Data.System.BuzzerSoundEffect); return; } bool _used = false; // If target is all if (targetWindow.Index == -1) { // Apply item effects to entire party foreach (GameActor actor in InGame.Party.Actors) { _used |= actor.ItemEffect(item); } } // If single target if (targetWindow.Index >= 0) { // Apply item use effects to target actor GameActor target = InGame.Party.Actors[targetWindow.Index]; _used = target.ItemEffect(item); } // If an item was used if (_used) { // Play item use SE InGame.System.SoundPlay(item.MenuSoundEffect); // If consumable if (item.Consumable) { // Decrease used items by 1 InGame.Party.LoseItem(item.Id, 1); // Redraw item window item itemWindow.DrawItem(itemWindow.Index); } // Remake target window contents targetWindow.Refresh(); // If all party members are dead if (InGame.Party.IsAllDead) { // Switch to game over screen Main.Scene = new SceneGameover(); return; } // If common event ID is valid if (item.CommonEventId > 0) { // Common event call reservation InGame.Temp.CommonEventId = item.CommonEventId; // Switch to map screen Main.Scene = new SceneMap(); return; } } // If item wasn't used if (!_used) { // Play buzzer SE InGame.System.SoundPlay(Data.System.BuzzerSoundEffect); } return; } }