Static manager that rolls and resolves random battle events in a terminal-style fighting game. Each event type adjusts player and AI HP, attack buffs, healing buffs, or daze flags, and prints log lines; some events open a choice popup handled by GameManager.
using Keyboard_Warriors_.Models;
using Keyboard_Warriors_.Systems;
using Sandbox;
using System;
using System.Collections.Generic;
using System.Linq;
using static Sandbox.Soundscape;
namespace Keyboard_Warriors_.Managers;
public static class RandomEventManager
{
public static bool HitJackpot { get; set; } = false;
private static Random rand = new Random();
public static void playSoundEffect( string soundEffect )
{
// Logs out directly to s&box engine diagnostics buffer
GameManager.AddLog( soundEffect );
}
public static void randomEvent( ref Player player, ref Player ai, ref int playerBuff, ref int aiBuff, SoundEvent pingSound )
{
if ( player == null || ai == null ) return;
Log.Info( $"The sound event is: {pingSound}" );
if ( pingSound != null )
{
Log.Info( "Sound is not null, attempting to play..." );
Sound.Play( pingSound );
}
else
{
Log.Error( "PING SOUND IS NULL! Check the Inspector!" );
}
// 10% structural trigger window matching legacy base engine mechanics
int eventType = rand.Next( 86 );
GameManager.AddEventLog( "\n=== RANDOM MAINWARE EVENT ===" );
switch (eventType)
{
case 0:
{
// 1. Fetch the GameManager from the active scene to read prestige scaling fields
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
// Keep the integrity of the prestige assignment variable right inside the case!
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// 2. Scale the healing output lineally (+4 extra healing per prestige level)
int totalPlayerHeal = 15 + (activePrestige * 4) + player.eventHealingBuff;
int totalAIHeal = 15 + (activePrestige * 4) + ai.eventHealingBuff;
// Symmetrical text output routing
if ( isMultiplayer )
{
GameManager.AddLog( $"** A strange green mist rolls in... Both players feel rejuvenated! ({player.name}: +{totalPlayerHeal} HP | {ai.name}: +{totalAIHeal} HP) **" );
}
else
{
GameManager.AddLog( $"** A strange green mist rolls in... Both players feel rejuvenated! (You: +{totalPlayerHeal} HP | AI: +{totalAIHeal} HP) **" );
}
player.hp += totalPlayerHeal;
ai.hp += totalAIHeal;
// 3. Dynamic Cap Check: Clamp to the true prestige max HP pools instead of hardcoded 100!
int maxPlayerHp = (manager != null && manager.LocalPlayer != null) ? manager.LocalPlayer.maxHp : 100;
int maxAIHp = (manager != null && manager.AIEnemy != null) ? manager.AIEnemy.maxHp : 100;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
// 4. CRITICAL CLEANUP: Consume the healing buffs so they apply only to this unique turn event!
player.eventHealingBuff = 0;
ai.eventHealingBuff = 0;
GameManager.AddLog( $"{player.name} is now at {player.hp} HP." );
GameManager.AddLog( $"{ai.name} is now at {ai.hp} HP." );
break;
}
case 1:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int scaledDamage = 10 + ((isMultiplayer ? 0 : prestige) * 3);
if ( isMultiplayer )
{
GameManager.AddLog( $"** An atmospheric blue electric surge fills the sky, {ai.name} gets zapped! -{scaledDamage}HP! **" );
}
else
{
GameManager.AddLog( $"** An atmospheric blue electric surge fills the sky, the AI gets zapped! -{scaledDamage}HP! **" );
}
CombatManager.applyDamage( ref ai, scaledDamage );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 2:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int scaledBuff = 10 + ((isMultiplayer ? 0 : prestige) * 3);
if ( isMultiplayer )
{
GameManager.AddLog( $"** A dagger drops into the terminal grid, {player.name}'s next attack will be boosted by {scaledBuff} next round! **" );
}
else
{
GameManager.AddLog( $"** A dagger is dropped by a horserider running by, your next attack will be boosted by {scaledBuff} next round! **" );
}
player.eventAttackBuff += scaledBuff;
break;
}
case 3:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
if ( isMultiplayer )
{
GameManager.AddLog( $"** The ground shakes violently! {player.name} and {ai.name} are both dazed! No attacks this round! **" );
// Re-arm your synced multiplayer speed chess flags to handle the network lockout loop
if ( manager != null )
{
manager.IsPlayerOneDazed = true;
manager.IsPlayerTwoDazed = true;
}
}
else
{
GameManager.AddLog( "** The ground shakes violently! Both fighters are dazed! No attacks this round! **" );
playerBuff = -999;
aiBuff = -999;
}
break;
}
case 4:
{
GameManager.AddLog( "** A chicken walks across the battlefield... it lays an egg... nothing happens **" );
break;
}
case 5:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int scaledDamage = 20 + ((isMultiplayer ? 0 : prestige) * 5);
if ( isMultiplayer )
{
GameManager.AddLog( $"** A uranium surge pulses through the grid! {player.name} and {ai.name} both get scorched! -{scaledDamage} HP! **" );
}
else
{
GameManager.AddLog( $"** A uranium surge pulses through the fighters! Everyone gets scorched! -{scaledDamage} HP! **" );
}
CombatManager.applyDamage( ref player, scaledDamage );
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
CombatManager.applyDamage( ref ai, scaledDamage );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 6:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
if ( isMultiplayer )
{
GameManager.AddLog( $"** A spaceship hovers overhead and fires a confusion ray! {player.name} and {ai.name}'s accuracy drops! **" );
}
else
{
GameManager.AddLog( "** A spaceship hovers overhead and fires a confusion ray! Accuracy drops! **" );
}
playerBuff = -1;
aiBuff = -1;
break;
}
case 7:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// Scale healing slightly (+2 per prestige) and add your new healing buffs
int totalPlayerHeal = 5 + (activePrestige * 2) + player.eventHealingBuff;
int totalAIHeal = 5 + (activePrestige * 2) + ai.eventHealingBuff;
if ( isMultiplayer )
{
GameManager.AddLog( $"** A mime walks silently across the battlefield miming a boxing match, taking damage and dealing... both laugh. ({player.name}: +{totalPlayerHeal} HP | {ai.name}: +{totalAIHeal} HP) **" );
}
else
{
GameManager.AddLog( $"** A mime walks silently across the battlefield miming a boxing match, taking damage and dealing... both laugh. (You: +{totalPlayerHeal} HP | AI: +{totalAIHeal} HP) **" );
}
player.hp += totalPlayerHeal;
ai.hp += totalAIHeal;
// Resolve safe prestige-scaled max caps
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
// Consume the healing buffs
player.eventHealingBuff = 0;
ai.eventHealingBuff = 0;
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 8:
{
GameManager.AddLog( "** An old man limps into view, shaking his cane: 'You two get a real job!' **" );
GameManager.AddLog( "*Everyone pauses in shame...*" );
break;
}
case 9:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR (Update 4.3.0)
// =========================================================================
// In single player, the target is always you.
// In multiplayer, it rolls a 50/50 chance to determine who gets the dropped event deliverable!
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // 🚀 Player 2 is selected as the package recipient!
}
int maxTargetHp = target.maxHp;
// =========================================================================
// Calculate scaled reward/risk parameters based on the active chosen target's values
int scaledImpHeal = 20 + (activePrestige * 5) + target.eventHealingBuff;
int scaledBarbBuff = 10 + (activePrestige * 3);
int scaledPotionHeal = 15 + (activePrestige * 4) + target.eventHealingBuff;
int scaledPotionBuff = 20 + (activePrestige * 5);
int scaledPotionDamage = 15 + (activePrestige * 4);
var p = target; // 🧼 Re-binds your structural shorthand pointer to our dynamic target!
var a = (target == player) ? ai : player; // Opponent is cleanly swapped based on target identity
var storkPackageEvent = new ChoiceEvent
{
Title = "📦 STORK'S DROPPED DELIVERABLE",
PromptText = isMultiplayer
? $"A stork glides into view and drops a clothed bag near {p.name}! What item will you pull from the package?"
: "A stork glides into view and drops a clothed bag, instead of a baby, it's a package! What item will you pull from the package?",
};
// --- BUTTON 1: GREEN TREE IMP ---
storkPackageEvent.Options.Add( new EventOption
{
ButtonText = "🟢 RELEASE GREEN TREE IMP",
ActionToExecute = () =>
{
if ( isMultiplayer ) GameManager.AddLog( $"The package releases a green tree imp, it winks, then emits a green healing mist towards {p.name}! +{scaledImpHeal} HP!" );
else GameManager.AddLog( $"The package releases a green tree imp, it winks, then emits a green healing mist your way! +{scaledImpHeal} HP!" );
p.hp += scaledImpHeal;
if ( p.hp > maxTargetHp ) p.hp = maxTargetHp;
p.eventHealingBuff = 0;
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
}
} );
// --- BUTTON 2: MINI BARBARIAN ---
storkPackageEvent.Options.Add( new EventOption
{
ButtonText = "⚔️ RELEASE MINI BARBARIAN",
ActionToExecute = () =>
{
if ( isMultiplayer ) GameManager.AddLog( $"The package releases a mini barbarian, it roars, boosting {p.name}'s strength! +{scaledBarbBuff} damage next attack!" );
else GameManager.AddLog( $"The package releases a mini barbarian, it roars, boosting a surge of strength! +{scaledBarbBuff} damage next attack!" );
p.eventAttackBuff += scaledBarbBuff;
}
} );
// --- BUTTON 3: MYSTERY POTION ---
storkPackageEvent.Options.Add( new EventOption
{
ButtonText = "🧪 DRINK MYSTERY POTION",
ActionToExecute = () =>
{
int outcome = Random.Shared.Next( 2 );
if ( outcome == 0 )
{
if ( isMultiplayer ) GameManager.AddLog( $"The potion is white and upon ingesting an angel blesses {p.name} and heals wounds for +{scaledPotionHeal} HP! and +{scaledPotionBuff} damage next attack!" );
else GameManager.AddLog( $"The potion is white and upon ingesting an angel blesses you and heals your wounds for +{scaledPotionHeal} HP! and +{scaledPotionBuff} damage next attack!" );
p.hp += scaledPotionHeal;
if ( p.hp > maxTargetHp ) p.hp = maxTargetHp;
p.eventAttackBuff += scaledPotionBuff;
p.eventHealingBuff = 0;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"The potion is black with skulls emanating from the liquid, it explodes in {p.name}'s face! -{scaledPotionDamage} HP!" );
else GameManager.AddLog( $"The potion is black with skulls emanating from the liquid, it explodes in your face! -{scaledPotionDamage} HP!" );
CombatManager.applyDamage( ref p, scaledPotionDamage );
}
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
}
} );
// Show the interactive choice alert row overlay
if ( isMultiplayer )
{
GameManager.AddLog( $"** A stork drops a package into the terminal cell! {p.name} is making an extraction choice... **" );
}
else
{
GameManager.AddLog( "** A stork glides into view and drops a clothed bag, instead of a baby, it's a package! **" );
GameManager.AddLog( "⚠️ WAITING FOR CORE PROTOCOL DATA OVERRIDE..." );
}
// In s&box, we send the UI prompt event.
// (For a true remote client setup, your networking script would Broadcast this to p's terminal specifically)
GameManager.Instance.TriggerChoicePopup( storkPackageEvent );
break;
}
case 10:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
if ( isMultiplayer )
{
GameManager.AddLog( $"** A lightning bolt strikes the center of the battlefield! The ground surges blue electric energy! The next attack from {player.name} and {ai.name} will be +20 damage! **" );
}
else
{
GameManager.AddLog( "** A lightning bolt strikes the center of the battlefield! The ground surges blue electric energy! The next attack from both fighters will be +20 damage! **" );
}
player.eventAttackBuff += 20;
ai.eventAttackBuff += 20;
break;
}
case 11:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
int scaledPenalty = 5 + (activePrestige * 1);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Gnome tickles Player 2 instead!
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( $"** A gnome runs up and tickles {target.name}'s armpit! {target.name} loses {scaledPenalty} attack points next round! **" );
}
else
{
GameManager.AddLog( $"** A gnome runs up and tickles your armpit! You lose {scaledPenalty} attack points next round! **" );
}
target.eventAttackBuff -= scaledPenalty;
break;
}
case 12:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Mirror appears in front of Player 2 instead!
}
// =========================================================================
int totalHeal = 10 + (activePrestige * 2) + target.eventHealingBuff;
if ( isMultiplayer )
{
GameManager.AddLog( $"** An enchanted mirror appears in front of {target.name}, showing a greater version of themselves. {target.name} is inspired! +{totalHeal} HP! **" );
}
else
{
GameManager.AddLog( $"** An enchanted mirror appears in front of you, showing a greater version of yourself. You're inspired! +{totalHeal} HP! **" );
}
target.hp += totalHeal;
int maxTargetHp = target.maxHp;
if ( target.hp > maxTargetHp ) target.hp = maxTargetHp;
target.eventHealingBuff = 0;
GameManager.AddLog( $"{target.name} | HP: {target.hp} | Armor: {target.defense}" );
break;
}
case 13:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref ai;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref player; // Player 1 glitches out instead of Player 2!
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( $"** {target.name} glitches and enters debug mode. It skips the next turn. **" );
if ( manager != null )
{
if ( target == player ) manager.IsPlayerOneDazed = true; // Modern speed-chess skip flag!
else manager.IsPlayerTwoDazed = true;
}
}
else
{
GameManager.AddLog( "** The AI glitches and enters debug mode. It skips the next turn. **" );
aiBuff = -999;
}
break;
}
case 14:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
int totalPlayerHeal = 10 + (activePrestige * 2) + player.eventHealingBuff;
int totalAIHeal = 10 + (activePrestige * 2) + ai.eventHealingBuff;
int scaledBuff = 5 + (activePrestige * 1);
if ( isMultiplayer )
{
GameManager.AddLog( $"** A passing bard sings a morale-boosting song! {player.name} recovers {totalPlayerHeal} HP, {ai.name} recovers {totalAIHeal} HP, and both gain +{scaledBuff} damage next round! **" );
}
else
{
GameManager.AddLog( $"** A passing bard sings a morale-boosting song! You recover {totalPlayerHeal} HP, AI recovers {totalAIHeal} HP, and both gain +{scaledBuff} damage next round! **" );
}
player.hp += totalPlayerHeal;
ai.hp += totalAIHeal;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
player.eventAttackBuff += scaledBuff;
ai.eventAttackBuff += scaledBuff;
player.eventHealingBuff = 0;
ai.eventHealingBuff = 0;
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 15:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
int scaledBuff = 20 + (activePrestige * 3);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref ai;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref player; // Player 1 performs operations instead of Player 2!
}
// =========================================================================
GameManager.Instance.PlayRoboticGlitchSound();
if ( isMultiplayer )
{
GameManager.AddLog( $"** {target.name} starts to perform mathematical operations, writes 10 chivalry poems every 5 seconds, and names off weapons you've never heard of! {target.name} gets a combat boost +{scaledBuff} points! **" );
}
else
{
GameManager.AddLog( $"**The AI starts to perform mathematical operations, writes 10 chivalry poems every 5 seconds, and names off weapons you've never heard of! AI gets a combat boost +{scaledBuff} points! **" );
}
target.eventAttackBuff += scaledBuff;
break;
}
case 16:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
// Symmetrically rolls a 50/50 chance to determine who receives the popup modal
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai;
}
int maxTargetHp = target.maxHp;
// =========================================================================
// Calculate scaled reward/risk boundaries based on the active target profile
int scaledSporeDamage = 15 + (activePrestige * 4);
int scaledSlapBuff = 15 + (activePrestige * 4);
int scaledTaleDamage = 10 + (activePrestige * 2);
int scaledTaleBuff = 10 + (activePrestige * 3);
int scaledTaleHeal = 10 + (activePrestige * 3) + target.eventHealingBuff;
var p = target; // Re-binds your structural shorthand pointer cleanly
var a = (target == player) ? ai : player;
var mushroomEvent = new ChoiceEvent
{
Title = "🍄 THE VEILED LADY REVELATION",
PromptText = isMultiplayer
? $"A massive veiled lady mushroom has manifested near {p.name}. It speaks directly into their digital consciousness. Will they attack it or listen?"
: "A massive veiled lady mushroom has manifested through the terminal grid core. It speaks directly into your digital consciousness. Will you attack it or listen?",
};
// --- OPTION 1: SLAP THE MUSHROOM ---
mushroomEvent.Options.Add( new EventOption
{
ButtonText = "💥 SLAP THE MUSHROOM",
ActionToExecute = () =>
{
int outcome = Random.Shared.Next( 2 );
if ( outcome == 0 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** The mushroom emits a misty toxic spore cloud and terrifies {p.name}! -{scaledSporeDamage} HP! **" );
else GameManager.AddLog( $"** The mushroom emits a misty toxic spore cloud and terrifies you! -{scaledSporeDamage} HP! **" );
CombatManager.applyDamage( ref p, scaledSporeDamage );
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"** The mushroom bursts into gold dust! {p.name} inhales power! +{scaledSlapBuff} attack next round! **" );
else GameManager.AddLog( $"** The mushroom bursts into gold dust! You inhale power! +{scaledSlapBuff} attack next round! **" );
p.eventAttackBuff += scaledSlapBuff;
}
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
}
} );
// --- OPTION 2: HEAR THE TALE ---
mushroomEvent.Options.Add( new EventOption
{
ButtonText = "📖 LISTEN TO ITS TALE",
ActionToExecute = () =>
{
int outcome = Random.Shared.Next( 2 );
if ( outcome == 0 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** The mushroom enters {p.name}'s emotions, telling a tale of tragic loss.. they feel emotionally drained. -{scaledTaleDamage} HP. **" );
else GameManager.AddLog( $"** The mushroom speaking to your mind enters your emotions, it tells you a tale of tragic loss.. you feel emotionally drained. -{scaledTaleDamage} HP. **" );
CombatManager.applyDamage( ref p, scaledTaleDamage );
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"** The mushroom infiltrates {p.name}'s endorphins and starts to whisper battle techniques! +{scaledTaleBuff} damage, +{scaledTaleHeal} HP restored! **" );
else GameManager.AddLog( $"** The mushroom infiltrates your endorphins and dopamine receptors and starts to whisper battle techniques! +{scaledTaleBuff} damage, +{scaledTaleHeal} HP restored! **" );
p.hp += scaledTaleHeal;
if ( p.hp > maxTargetHp ) p.hp = maxTargetHp;
p.eventAttackBuff += scaledTaleBuff;
p.eventHealingBuff = 0;
}
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
}
} );
// Broadcast setup warnings across the system logs
if ( isMultiplayer )
{
GameManager.AddLog( $"** A veiled lady mushroom sprouts dramatically! {p.name} is connected via neural link... **" );
}
else
{
GameManager.AddLog( "** A veiled lady mushroom sprouts dramatically and whispers in your mind: 'Slap me or hear my tale... your fate awaits.' **" );
GameManager.AddLog( "⚠️ WAITING FOR NEURAL LINK RECEPTION..." );
}
// Fires the popup layer and freezes tactical move sequencing until resolved
GameManager.Instance.TriggerChoicePopup( mushroomEvent );
break;
}
case 17:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Mirror floats in front of Player 2 instead!
}
int maxTargetHp = target.maxHp;
// =========================================================================
int totalHeal = 15 + (activePrestige * 3) + target.eventHealingBuff;
int scaledBuff = 10 + (activePrestige * 2);
int scaledLossHp = 10 + (activePrestige * 2);
int scaledLossBuff = 5 + (activePrestige * 1);
if ( isMultiplayer )
{
GameManager.AddLog( $"** An enchanted mirror floats before {target.name}, refracting with ethereal light... **" );
}
else
{
GameManager.AddLog( "** An enchanted mirror floats before you, refracting with ethereal light... **" );
}
int outcome = Random.Shared.Next( 2 );
if ( outcome == 0 )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"** The reflection smiles proudly - a future champion! {target.name} is inspired! +{totalHeal} HP and +{scaledBuff} attack next round! **" );
}
else
{
GameManager.AddLog( $"** The reflection smiles proudly - a future champion! You're inspired! +{totalHeal} HP and +{scaledBuff} attack next round! **" );
}
target.hp += totalHeal;
if ( target.hp > maxTargetHp ) target.hp = maxTargetHp;
target.eventAttackBuff += scaledBuff;
target.eventHealingBuff = 0;
}
else
{
if ( isMultiplayer )
{
GameManager.AddLog( $"** The reflection looks at {target.name} as a stranger, then laughs at them mockingly. {target.name} loses confidence. -{scaledLossHp} HP and -{scaledLossBuff} attack next round. **" );
}
else
{
GameManager.AddLog( $"** The reflection looks at you as a stranger, then laughs at you mockingly. You lose confidence. -{scaledLossHp} HP and -{scaledLossBuff} attack next round. **" );
}
target.hp -= scaledLossHp;
target.eventAttackBuff -= scaledLossBuff;
}
GameManager.AddLog( $"{target.name} | HP: {target.hp} | Armor: {target.defense}" );
break;
}
case 18:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Future version of Player 2 steps out instead!
}
int maxTargetHp = target.maxHp;
// =========================================================================
int totalNanobotHeal = 25 + (activePrestige * 4) + target.eventHealingBuff;
int scaledParadoxDamage = 10 + (activePrestige * 2);
int scaledParadoxBuffLoss = 5 + (activePrestige * 1);
if ( isMultiplayer )
{
GameManager.AddLog( $"** A wormhole tears open in front of {target.name}! A future version of them steps out, battle-scarred and glowing with knowledge... **" );
}
else
{
GameManager.AddLog( "** A wormhole tears open in front of you! A future version of you steps out, battle-scarred and glowing with knowledge... **" );
}
int outcome = Random.Shared.Next( 2 );
if ( outcome == 0 )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"** They nod solemnly and hand {target.name} a device: 'Use this.. to help you with this battle.' It's a healing nanobot swarm! +{totalNanobotHeal} HP! **" );
}
else
{
GameManager.AddLog( $"** They shake their head: 'You weren't supposed to come here...' They vanish in a flash of paradox light. You're dazed. -{scaledParadoxDamage} HP, -{scaledParadoxBuffLoss} attack next round. **" );
}
target.hp += totalNanobotHeal;
if ( target.hp > maxTargetHp ) target.hp = maxTargetHp;
target.eventHealingBuff = 0;
}
else
{
if ( isMultiplayer )
{
GameManager.AddLog( $"** They shake their head: '{target.name} wasn't supposed to come here...' They vanish in a flash of paradox light. {target.name} is dazed. -{scaledParadoxDamage} HP, -{scaledParadoxBuffLoss} attack next round. **" );
}
else
{
GameManager.AddLog( $"** They shake their head: 'You weren't supposed to come here...' They vanish in a flash of paradox light. You're dazed. -{scaledParadoxDamage} HP, -{scaledParadoxBuffLoss} attack next round. **" );
}
CombatManager.applyDamage( ref target, scaledParadoxDamage );
target.eventAttackBuff -= scaledParadoxBuffLoss;
}
GameManager.AddLog( $"{target.name} | HP: {target.hp} | Armor: {target.defense}" );
break;
}
case 19:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int scaledColdDamage = 15 + ((isMultiplayer ? 0 : prestige) * 3);
// =========================================================================
// 🎯 MULTIPLAYER BEGGAR SPLIT TARGETING (Chance for Either or Both!)
// =========================================================================
if ( isMultiplayer )
{
int beggarRoll = Random.Shared.Next( 3 ); // 0 = Player 1, 1 = Player 2, 2 = Both!
if ( beggarRoll == 0 )
{
GameManager.AddLog( $"** A beggar walks nearby and coughs at {player.name}, giving them a nasty cold! -{scaledColdDamage} HP! **" );
CombatManager.applyDamage( ref player, scaledColdDamage );
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
}
else if ( beggarRoll == 1 )
{
GameManager.AddLog( $"** A beggar walks nearby and coughs at {ai.name}, giving them a nasty cold! -{scaledColdDamage} HP! **" );
CombatManager.applyDamage( ref ai, scaledColdDamage );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
}
else
{
GameManager.AddLog( $"** A beggar walks between the terminals and coughs at BOTH fighters! Spreading a nasty cold! -{scaledColdDamage} HP each! **" );
CombatManager.applyDamage( ref player, scaledColdDamage );
CombatManager.applyDamage( ref ai, scaledColdDamage );
GameManager.AddLog( $"{player.name} | HP: {player.hp} | {ai.name} | HP: {ai.hp}" );
}
}
else
{
// 🤖 SINGLE PLAYER: Legacy un-edited behavior
GameManager.AddLog( $"** A beggar walks nearby and coughs at you, giving you a nasty cold! -{scaledColdDamage} HP! **" );
CombatManager.applyDamage( ref player, scaledColdDamage );
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
}
// =========================================================================
break;
}
case 20:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int baseRoll = Random.Shared.Next( 6 ) + 5;
int calculatedAIBuff = baseRoll + ((isMultiplayer ? 0 : prestige) * 2);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref ai;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref player; // Player 1 optimizes routines instead of Player 2!
}
// =========================================================================
target.eventAttackBuff += calculatedAIBuff;
if ( isMultiplayer )
{
GameManager.AddLog( $"** {target.name} proceeds with lightning fast optimization and patches its combat routines! **" );
GameManager.AddLog( $"** {target.name}'s attack caused +{calculatedAIBuff} damage points! **" );
}
else
{
GameManager.AddLog( "** The AI proceeds with lightning fast optimization and patches its combat routines! **" );
GameManager.AddLog( $"** AI's attack caused +{calculatedAIBuff} damage points! **" );
}
break;
}
case 21:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int baseRoll = Random.Shared.Next( 7 ) + 4;
int calculatedBuff = baseRoll + ((isMultiplayer ? 0 : prestige) * 2);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref ai;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref player; // Player 1 receives the targeting data instead!
}
// =========================================================================
target.eventAttackBuff += calculatedBuff;
if ( isMultiplayer )
{
GameManager.AddLog( $"** {target.name} receives targeting data from the heavens! **" );
GameManager.AddLog( $"** {target.name}'s buff increases by {calculatedBuff} damage points! **" );
}
else
{
GameManager.AddLog( "** The AI receives targeting data from the heavens! **" );
GameManager.AddLog( $"** AI's buff increases by {calculatedBuff} damage points! **" );
}
break;
}
case 22:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref ai;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref player; // Chaos fluctuation strikes Player 1 instead!
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( $"** A purple unknown energy fills the air and causes heavy vibrations teeming with power! {target.name}'s system... **" );
}
else
{
GameManager.AddLog( "** A purple unknown energy fills the air and causes heavy vibrations teeming with power! The AI's system... **" );
}
int baseFluctuation = (Random.Shared.Next( 2 ) == 0) ? -3 : 5;
if ( baseFluctuation > 0 )
{
int finalBuff = baseFluctuation + (activePrestige * 2);
target.eventAttackBuff += finalBuff;
GameManager.AddLog( $"spikes with a chaotic flux! Attack is at +{finalBuff} damage points" );
}
else
{
int finalBuffPenalty = baseFluctuation - (activePrestige * 1);
target.eventAttackBuff += finalBuffPenalty;
GameManager.AddLog( $"loses control of its operating system! It has lost {finalBuffPenalty} damage points" );
}
break;
}
case 23:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
// =========================================================================
// 🎯 MULTIPLAYER DIRT PITCH MULTI-TARGET CHECK (Chance for Either or Both!)
// =========================================================================
if ( isMultiplayer )
{
int dirtRoll = Random.Shared.Next( 3 ); // 0 = Player 1 Stunned, 1 = Player 2 Stunned, 2 = Both!
if ( dirtRoll == 0 )
{
GameManager.AddLog( $"** {ai.name} scoops up dirt from the arena floor and pitches it right into {player.name}'s eyes! **" );
GameManager.AddLog( $"** {player.name} stumbles around blinded and loses attack next round! **" );
if ( manager != null ) manager.IsPlayerOneDazed = true;
}
else if ( dirtRoll == 1 )
{
GameManager.AddLog( $"** {player.name} scoops up dirt from the arena floor and pitches it right into {ai.name}'s eyes! **" );
GameManager.AddLog( $"** {ai.name} stumbles around blinded and loses attack next round! **" );
if ( manager != null ) manager.IsPlayerTwoDazed = true;
}
else
{
GameManager.AddLog( "** An arena debris flare kicks up dirt and blinds BOTH fighters' vision screens! **" );
GameManager.AddLog( "** Both players scramble blindly and lose their attacks next round! **" );
if ( manager != null )
{
manager.IsPlayerOneDazed = true;
manager.IsPlayerTwoDazed = true;
}
}
}
else
{
// 🤖 SINGLE PLAYER: Legacy un-edited behavior and servo arm flavor text
GameManager.AddLog( "** The AI scoops up dirt with its servo arm and pitches it right into your eyes! **" );
GameManager.AddLog( "** You scream in stinging eye pain as you grasp your face, you aren't facing the opponent and stumble around! You lose attack next round! **" );
playerBuff = -999;
}
// =========================================================================
break;
}
case 24:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Player 2 throws in a prayer instead!
}
int maxTargetHp = target.maxHp;
// =========================================================================
int totalBlessHeal = 10 + (activePrestige * 2) + target.eventHealingBuff;
int scaledBlessBuff = 15 + (activePrestige * 3);
int scaledCurseDamage = 10 + (activePrestige * 2);
int scaledCurseBuffLoss = 15 + (activePrestige * 3);
if ( isMultiplayer )
{
GameManager.AddLog( $"** {target.name} throws in a quick prayer and asks for assistance! **" );
}
else
{
GameManager.AddLog( "** You throw in a quick prayer and ask for assistance! **" );
}
int outcome = Random.Shared.Next( 2 );
if ( outcome == 0 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** Assisted by a divine energy, {target.name} has been blessed with +{totalBlessHeal} HP and +{scaledBlessBuff} attack! **" );
else GameManager.AddLog( $"** Your answered by a divine energy, you have been blessed with +{totalBlessHeal} HP and +{scaledBlessBuff} attack! **" );
target.hp += totalBlessHeal;
if ( target.hp > maxTargetHp ) target.hp = maxTargetHp;
target.eventAttackBuff += scaledBlessBuff;
target.eventHealingBuff = 0;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"** {target.name} is ignored and forsaken with their prayer denied! An evil energy overconsumes their grid. Cursed with -{scaledCurseDamage} HP and -{scaledCurseBuffLoss} attack! **" );
else GameManager.AddLog( $"** You're ignored and forsaken with your prayer denied and you feel an evil energy overconsume you. You have been cursed with -{scaledCurseDamage} HP and -{scaledCurseBuffLoss} attack! **" );
CombatManager.applyDamage( ref target, scaledCurseDamage );
target.eventAttackBuff -= scaledCurseBuffLoss;
}
GameManager.AddLog( $"{target.name} | HP: {target.hp} | Armor: {target.defense}" );
break;
}
case 25:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 MULTIPLAYER AUTOMATIC SIMULTANEOUS DICE DUEL
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( $"** Dynamic probability arrays activate! Both players throw two dice to determine their attack fate! **" );
// Roll for Player 1
int p1Die1 = Random.Shared.Next( 6 ) + 1;
int p1Die2 = Random.Shared.Next( 6 ) + 1;
int p1Sum = p1Die1 + p1Die2;
player.eventAttackBuff += p1Sum;
GameManager.AddLog( $"🎲 {player.name} rolled a {p1Die1} and a {p1Die2} (Total: {p1Sum})! Attack buff increased by +{p1Sum}!" );
// Roll for Player 2
int p2Die1 = Random.Shared.Next( 6 ) + 1;
int p2Die2 = Random.Shared.Next( 6 ) + 1;
int p2Sum = p2Die1 + p2Die2;
ai.eventAttackBuff += p2Sum;
GameManager.AddLog( $"🎲 {ai.name} rolled a {p2Die1} and a {p2Die2} (Total: {p2Sum})! Attack buff increased by +{p2Sum}!" );
}
else
{
// 🤖 SINGLE PLAYER: Legacy un-edited behavior
GameManager.AddLog( "** You throw two dice to determine your attack fate! **" );
int die1 = Random.Shared.Next( 6 ) + 1;
int die2 = Random.Shared.Next( 6 ) + 1;
int diceSum = die1 + die2;
int scaledSum = diceSum + (activePrestige * 2);
GameManager.AddLog( $"** You rolled a {die1} and a {die2} for a total of {diceSum}! **" );
GameManager.AddLog( $"** Your attack buff increases by {scaledSum} points! **" );
player.eventAttackBuff += scaledSum;
}
// =========================================================================
break;
}
case 26:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 MULTIPLAYER SELECTION PASS ROUTER
// =========================================================================
if ( isMultiplayer )
{
// Reroute back to Case 25 so both players get dice rolled automatically!
rand.Next( 86 ); // Re-seed background roll
goto case 25;
}
else
{
// 🤖 SINGLE PLAYER: Legacy un-edited behavior
GameManager.AddLog( "** The AI displays a hologram projection of two dice... **" );
int die1 = Random.Shared.Next( 6 ) + 1;
int die2 = Random.Shared.Next( 6 ) + 1;
int total = die1 + die2;
int scaledTotal = total + (activePrestige * 2);
GameManager.AddLog( $"** The AI rolls a {die1} and a {die2}! Total: {total} **" );
GameManager.AddLog( $"** The hologram dice charge the AI's attack with +{scaledTotal} damage next round! **" );
ai.eventAttackBuff += scaledTotal;
}
// =========================================================================
break;
}
case 27:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int baseDamage = Random.Shared.Next( 11 ) + 10;
int scaledDamage = baseDamage + ((isMultiplayer ? 0 : prestige) * 3);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Player 2 gets zapped instead!
}
if ( isMultiplayer )
{
GameManager.AddLog( $"** {target.name} is shocked and twitching! -{scaledDamage} HP and their processor is stunned for a round! **" );
if ( manager != null )
{
if ( target == player ) manager.IsPlayerOneDazed = true;
else manager.IsPlayerTwoDazed = true;
}
}
else
{
// 🤖 SINGLE PLAYER: Legacy un-edited behavior
playerBuff = -999;
GameManager.AddLog( $"** You're shocked and twitching! -{scaledDamage} HP and you're stunned for a round! **" );
}
// =========================================================================
CombatManager.applyDamage( ref target, scaledDamage );
playSoundEffect( "*BZZZZTTT!*" );
GameManager.AddLog( $"{target.name} | HP: {target.hp} | Armor: {target.defense}" );
break;
}
case 28:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 MULTIPLAYER SIMULTANEOUS LOTTERY TICKETS
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "** Both players find mysterious scratch-off lottery tickets on the battlefield... **" );
GameManager.AddLog( " It reads: '1 in 1000 chance to win BIG!' Both nervously scratch their cards..." );
// Evaluate Player 1
int p1Luck = Random.Shared.Next( 1000 );
int p1Heal = 100 + player.eventHealingBuff;
if ( p1Luck == 0 )
{
GameManager.AddLog( $"** JACKPOT!!! {player.name} won the mythical prize! +{p1Heal}HP and +100 attack next round! **" );
player.hp += p1Heal;
if ( player.hp > player.maxHp ) player.hp = player.maxHp;
player.eventAttackBuff += 100;
player.eventHealingBuff = 0;
HitJackpot = true;
}
else GameManager.AddLog( $"** {player.name} LOSES!!! Their ticket crumbles to dust." );
// Evaluate Player 2
int p2Luck = Random.Shared.Next( 1000 );
int p2Heal = 100 + ai.eventHealingBuff;
if ( p2Luck == 0 )
{
GameManager.AddLog( $"** JACKPOT!!! {ai.name} won the mythical prize! +{p2Heal}HP and +100 attack next round! **" );
ai.hp += p2Heal;
if ( ai.hp > ai.maxHp ) ai.hp = ai.maxHp;
ai.eventAttackBuff += 100;
ai.eventHealingBuff = 0;
HitJackpot = true;
}
else GameManager.AddLog( $"** {ai.name} LOSES!!! Their ticket crumbles to dust." );
GameManager.AddLog( $"{player.name} HP: {player.hp} | {ai.name} HP: {ai.hp}" );
}
else
{
// 🤖 SINGLE PLAYER: Legacy un-edited behavior
int totalJackpotHeal = 100 + (activePrestige * 15) + player.eventHealingBuff;
int scaledJackpotBuff = 100 + (activePrestige * 15);
int maxPlayerHp = (manager != null && manager.LocalPlayer != null) ? manager.LocalPlayer.maxHp : 100;
GameManager.AddLog( "** You find a mysterious scratch-off lottery ticket on the battlefield... **" );
GameManager.AddLog( " It reads: '1 in 1000 chance to win BIG!' You nervously scratch it.." );
int luck = Random.Shared.Next( 1000 );
if ( luck == 0 )
{
GameManager.AddLog( $"** JACKPOT!!! You've won the mythical grand prize! +{totalJackpotHeal}HP and +{scaledJackpotBuff} attack next round! **" );
player.hp += totalJackpotHeal;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
player.eventAttackBuff += scaledJackpotBuff;
player.eventHealingBuff = 0;
HitJackpot = true;
}
else
{
GameManager.AddLog( "** YOU LOSE!!! The ticket crumbles to dust. You droop your head in gambling shame. **" );
}
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
}
// =========================================================================
break;
}
case 29:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int pBonus = isMultiplayer ? 0 : (prestige * 2);
// =========================================================================
// 🎯 MULTIPLAYER AUTOMATIC SIMULTANEOUS D100 DUEL
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "** Mythical d100 probability gates activate! Time and physics decides BOTH players' power this turn! **" );
// --- Player 1 Rolls ---
int p1Roll = Random.Shared.Next( 100 ) + 1;
GameManager.AddLog( $"** {player.name} rolled: {p1Roll}! **" );
if ( p1Roll == 100 )
{
player.eventAttackBuff += 50;
GameManager.AddLog( $"** LEGENDARY ROLL! +50 attack to {player.name} this round!! **" );
}
else if ( p1Roll >= 90 )
{
player.eventAttackBuff += 30;
GameManager.AddLog( $"** Incredible! +30 attack to {player.name}! **" );
}
else if ( p1Roll >= 70 )
{
player.eventAttackBuff += 15;
GameManager.AddLog( $"** Not bad! +15 attack to {player.name}! **" );
}
else if ( p1Roll >= 40 )
{
player.eventAttackBuff += 5;
GameManager.AddLog( $"** A small edge. +5 attack to {player.name}! **" );
}
else if ( p1Roll >= 10 )
{
player.eventAttackBuff -= 10;
GameManager.AddLog( $"** Oof... -10 attack to {player.name} this round. **" );
}
else
{
player.eventAttackBuff -= 20;
GameManager.AddLog( $"** CURSED! -20 attack to {player.name}! The dice, physics, God, time, and gravity hate {player.name}!! **" );
}
// --- Player 2 Rolls ---
int p2Roll = Random.Shared.Next( 100 ) + 1;
GameManager.AddLog( $"** {ai.name} rolled: {p2Roll}! **" );
if ( p2Roll == 100 )
{
ai.eventAttackBuff += 50;
GameManager.AddLog( $"** CRITICAL ALGORITHM SUCCESS! {ai.name} gains +50 attack! **" );
}
else if ( p2Roll >= 90 )
{
ai.eventAttackBuff += 30;
GameManager.AddLog( $"** {ai.name} adds up the good result into +30 attack damage! **" );
}
else if ( p2Roll >= 70 )
{
ai.eventAttackBuff += 15;
GameManager.AddLog( $"** {ai.name} compiles with +15 attack! **" );
}
else if ( p2Roll >= 40 )
{
ai.eventAttackBuff += 5;
GameManager.AddLog( $"** {ai.name} musters a small +5 attack! **" );
}
else if ( p2Roll >= 10 )
{
ai.eventAttackBuff -= 10;
GameManager.AddLog( $"** {ai.name} finds some bugs messing up the d100 roll! -10 attack! **" );
}
else
{
ai.eventAttackBuff -= 20;
GameManager.AddLog( $"** BLUE SCREEN! {ai.name} loses 20 attack power! **" );
}
}
else
{
// 🤖 SINGLE PLAYER: Your exact, un-edited original log blocks and math
GameManager.AddLog( "** You roll a mythical d100... time and physics decides your power this turn! **" );
int roll = Random.Shared.Next( 100 ) + 1;
GameManager.AddLog( $"** You rolled: {roll}! **" );
if ( roll == 100 )
{
int amt = 50 + pBonus;
player.eventAttackBuff += amt;
GameManager.AddLog( $"** LEGENDARY ROLL! +{amt} attack this round!! **" );
}
else if ( roll >= 90 )
{
int amt = 30 + pBonus;
player.eventAttackBuff += amt;
GameManager.AddLog( $"** Incredible! +{amt} attack! **" );
}
else if ( roll >= 70 )
{
int amt = 15 + pBonus;
player.eventAttackBuff += amt;
GameManager.AddLog( $"** Not bad! +{amt} attack! **" );
}
else if ( roll >= 40 )
{
int amt = 5 + pBonus;
player.eventAttackBuff += amt;
GameManager.AddLog( $"** A small edge. +{amt} attack! **" );
}
else if ( roll >= 10 )
{
int amt = 10 + pBonus;
player.eventAttackBuff -= amt;
GameManager.AddLog( $"** Oof... -{amt} attack this round. **" );
}
else
{
int amt = 20 + pBonus;
player.eventAttackBuff -= amt;
GameManager.AddLog( $"** CURSED! -{amt} attack! The dice, physics, God, time, and gravity hate you!! (at this moment) **" );
}
}
// =========================================================================
break;
}
case 30:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int pBonus = isMultiplayer ? 0 : (prestige * 2);
// =========================================================================
// 🎯 MULTIPLAYER AUTOMATIC DUEL REDIRECTOR
// =========================================================================
if ( isMultiplayer )
{
// Re-seed and drop right back into Case 29 so both human terminals get rolled simultaneously!
eventType = rand.Next( 86 );
goto case 29;
}
else
{
// 🤖 SINGLE PLAYER: Legacy un-edited behavior for the AI Overlord's standalone turn roll
GameManager.AddLog( "** The AI projects its hologram of a d100 and rolls it! **" );
int roll = Random.Shared.Next( 100 ) + 1;
GameManager.AddLog( $"** AI rolled: {roll}! **" );
if ( roll == 100 )
{
int amt = 50 + pBonus;
ai.eventAttackBuff += amt;
GameManager.AddLog( $"** CRITICAL ALGORITHM SUCCESS! AI gains +{amt} attack! **" );
}
else if ( roll >= 90 )
{
int amt = 30 + pBonus;
ai.eventAttackBuff += amt;
GameManager.AddLog( $"** AI adds up the good result into +{amt} attack damage! **" );
}
else if ( roll >= 70 )
{
int amt = 15 + pBonus;
ai.eventAttackBuff += amt;
GameManager.AddLog( $"** AI compiles with +{amt} attack! **" );
}
else if ( roll >= 40 )
{
int amt = 5 + pBonus;
ai.eventAttackBuff += amt;
GameManager.AddLog( $"** AI musters a small +{amt} attack! **" );
}
else if ( roll >= 10 )
{
int amt = 10 + pBonus;
ai.eventAttackBuff -= amt;
GameManager.AddLog( $"** AI finds some bugs messing up the d100 roll! -{amt} attack! **" );
}
else
{
int amt = 20 + pBonus;
ai.eventAttackBuff -= amt;
GameManager.AddLog( $"** BLUE SCREEN! AI loses {amt} attack power! **" );
}
}
// =========================================================================
break;
}
case 31:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int baseIntensity = Random.Shared.Next( 6 ) + 5; // 5 to 10
int scaledIntensity = baseIntensity + ((isMultiplayer ? 0 : prestige) * 2);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref ai;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref player; // Player 1 drops the bass instead of Player 2!
}
// =========================================================================
target.eventAttackBuff += scaledIntensity;
if ( isMultiplayer )
{
GameManager.AddLog( $"** {target.name} operates the DJ set and plays an electrifying electronic beat! **" );
GameManager.AddLog( "** The bass drops so hard the battlefield trembles... **" );
GameManager.AddLog( $"** {target.name}'s attack is boosted by +{scaledIntensity} damage next round! **" );
GameManager.AddLog( $"{target.name.ToUpper()}: \"Prepare for my Bass Cannon! - WUUUB WUB WUBB.\"" );
}
else
{
GameManager.AddLog( "** The AI operates its DJ set and plays an electrifying electronic beat! **" );
GameManager.AddLog( "** The bass drops so hard the battlefield trembles... **" );
GameManager.AddLog( $"** AI's attack is boosted by +{scaledIntensity} damage next round! **" );
GameManager.AddLog( "AI: \"Prepare for my Bass Cannon! - WUUUB WUB WUBB.\"" );
}
break;
}
case 32:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
int scaledPlayerBuff = 10 + (activePrestige * 2);
int scaledAIBuff = 15 + (activePrestige * 2);
GameManager.AddLog( "** The sun suddenly powers off and goes dark **" );
int whoRecovers = Random.Shared.Next( 2 );
if ( whoRecovers == 0 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {player.name} adapts to the night. Next attack is guaranteed +{scaledPlayerBuff}! **" );
else GameManager.AddLog( $"** You adapt to the night. Next attack is guaranteed +{scaledPlayerBuff}! **" );
player.eventAttackBuff += scaledPlayerBuff;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"** {ai.name}'s night vision kicks in. It gains +{scaledAIBuff} attack next round! **" );
else GameManager.AddLog( $"** The AI's night vision kicks in. It gains +{scaledAIBuff} attack next round! **" );
ai.eventAttackBuff += scaledAIBuff;
}
break;
}
case 33:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int pBonus = isMultiplayer ? 0 : (prestige * 2);
GameManager.AddLog( "** A strange anomaly appears on the battlefield! **" );
int roll = Random.Shared.Next( 100 ) + 1;
GameManager.AddLog( $"** Rolling for fate... you rolled: {roll}! **" );
if ( roll <= 40 )
{
int dmg = Random.Shared.Next( 10 ) + 5 + pBonus;
CombatManager.applyDamage( ref player, dmg );
if ( player.hp < 0 ) player.hp = 0;
if ( isMultiplayer ) GameManager.AddLog( $"** A sudden shockwave hits {player.name}! -{dmg} HP! **" );
else GameManager.AddLog( $"** A sudden shockwave hits YOU! -{dmg} HP! **" );
}
else if ( roll <= 70 )
{
int dmg = Random.Shared.Next( 10 ) + 5 + pBonus;
CombatManager.applyDamage( ref ai, dmg );
if ( ai.hp < 0 ) ai.hp = 0;
if ( isMultiplayer ) GameManager.AddLog( $"** The anomaly backfires on {ai.name}! -{dmg} HP! **" );
else GameManager.AddLog( $"** The anomaly backfires on the AI! -{dmg} HP! **" );
}
else if ( roll <= 90 )
{
int dmg = Random.Shared.Next( 5 ) + 1 + pBonus;
CombatManager.applyDamage( ref player, dmg );
CombatManager.applyDamage( ref ai, dmg );
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
GameManager.AddLog( $"** Both fighters are affected! -{dmg} HP each! **" );
}
else
{
GameManager.AddLog( "** Miraculously, nothing happens! Fate smiles on both combatants! **" );
}
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 34:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int pBonus = isMultiplayer ? 0 : (prestige * 3);
GameManager.AddLog( "** The combatants unleash unpredictable signature moves! **" );
int roll = Random.Shared.Next( 100 ) + 1;
if ( roll <= 35 )
{
int dmg = Random.Shared.Next( 15 ) + 10 + pBonus;
CombatManager.applyDamage( ref player, dmg );
if ( player.hp < 0 ) player.hp = 0;
if ( isMultiplayer ) GameManager.AddLog( $"** A spinning whirlwind of energy strikes {player.name}! -{dmg} HP! **" );
else GameManager.AddLog( $"** A spinning whirlwind of energy strikes YOU! -{dmg} HP! **" );
}
else if ( roll <= 70 )
{
int dmg = Random.Shared.Next( 15 ) + 10 + pBonus;
CombatManager.applyDamage( ref ai, dmg );
if ( ai.hp < 0 ) ai.hp = 0;
if ( isMultiplayer ) GameManager.AddLog( $"** {ai.name} performs a devastating laser strike upon itself! -{dmg} HP! **" );
else GameManager.AddLog( $"** The AI performs a devastating laser strike upon itself! -{dmg} HP! **" );
}
else if ( roll <= 90 )
{
int dmg = Random.Shared.Next( 8 ) + 5 + pBonus;
CombatManager.applyDamage( ref player, dmg );
CombatManager.applyDamage( ref ai, dmg );
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
GameManager.AddLog( $"** A chaotic collision of moves hits both combatants! -{dmg} HP! **" );
}
else
{
GameManager.AddLog( "** The moves miss spectacularly! No one is hurt. **" );
}
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 35:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int pBonus = isMultiplayer ? 0 : (prestige * 4);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
ref Player opponent = ref ai;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Player 2 is asked the logic riddle!
opponent = ref player; // Player 1 becomes the mocker/opponent!
}
// =========================================================================
GameManager.AddLog( "** A LOGIC CHALLENGE APPEARS! **" );
GameManager.AddLog( "It questions: 'If all X are Y, and all Y are Z, then all X are...?' " );
int roll = Random.Shared.Next( 100 ) + 1;
GameManager.AddLog( $"** {target.name} rolls the logic dice... ({roll}) **" );
if ( roll >= 95 )
{
int finalDmg = 35 + pBonus;
GameManager.AddLog( $"** GENIUS! {target.name} gives the flawless answer: 'All X are Z.' **" );
CombatManager.applyDamage( ref opponent, finalDmg );
if ( opponent.hp < 0 ) opponent.hp = 0;
GameManager.AddLog( $"** Their brilliance strikes {opponent.name} for {finalDmg} damage! **" );
}
else if ( roll >= 75 )
{
int finalDmg = 20 + pBonus;
GameManager.AddLog( $"** Strong reasoning! {target.name} almost nails it but misses a small detail. **" );
CombatManager.applyDamage( ref opponent, finalDmg );
if ( opponent.hp < 0 ) opponent.hp = 0;
GameManager.AddLog( $"** {opponent.name} loses {finalDmg} health from being mentally outmaneuvered. **" );
}
else if ( roll >= 50 )
{
int finalDmg = 20 + pBonus;
GameManager.AddLog( $"** {target.name}'s logic becomes shaky. **" );
CombatManager.applyDamage( ref target, finalDmg );
if ( target.hp < 0 ) target.hp = 0;
GameManager.AddLog( $"** {opponent.name} mocks their flawed reasoning! {target.name} takes {finalDmg} psychic damage! **" );
}
else if ( roll >= 25 )
{
int finalDmg = 35 + pBonus;
GameManager.AddLog( $"** {target.name} answers: 'All X are treasure.' **" );
CombatManager.applyDamage( ref target, finalDmg );
if ( target.hp < 0 ) target.hp = 0;
GameManager.AddLog( $"** {opponent.name} cackles and fries their neurons. -{finalDmg} health! **" );
}
else
{
int finalDmg = 40 + pBonus;
GameManager.AddLog( $"** CRITICAL LOGIC FAILURE!! {target.name} says: 'If all X are Y... then all Z are X!!' (The opposite!). **" );
CombatManager.applyDamage( ref target, finalDmg );
if ( target.hp < 0 ) target.hp = 0;
if ( isMultiplayer ) GameManager.AddLog( $"** {opponent.name} obliterates them with active counter-logic that leaves them confused! -{finalDmg} health!! **" );
else GameManager.AddLog( $"** The AI 'obliterates you' with 'active learning techniques' that leave you more confused! Wait Time = -{finalDmg} health!! **" );
}
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 36:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Standard scaling increments for rewards or penalties (+2 to +3 per tier)
int scaledHighVal = 20 + ((isMultiplayer ? 0 : prestige) * 3);
int scaledMidVal = 10 + ((isMultiplayer ? 0 : prestige) * 2);
if ( isMultiplayer )
{
GameManager.AddLog( $"** An officer suddenly appears! Both {player.name} and {ai.name} must explain yourselves! **" );
}
else
{
GameManager.AddLog( "** An officer suddenly appears! Both you and the AI must explain yourselves! **" );
}
int playerExcuse = Random.Shared.Next( 100 ) + 1;
int aiExcuse = Random.Shared.Next( 100 ) + 1;
GameManager.AddLog( $"{player.name} rolled a {playerExcuse} for their excuse." );
GameManager.AddLog( $"{ai.name} rolled a {aiExcuse} for their excuse." );
// --- PLAYER 1 RESOLUTION ---
if ( playerExcuse >= 90 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {player.name}'s excuse was flawless. The officer is completely convinced! +{scaledHighVal} Buff & HP! **" );
else GameManager.AddLog( $"** Your excuse was flawless. The officer is completely convinced! +{scaledHighVal} Buff & HP! **" );
player.eventAttackBuff += scaledHighVal;
player.hp += scaledHighVal;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
}
else if ( playerExcuse >= 60 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {player.name}'s excuse is solid. They scrape by the officer. +{scaledMidVal} attack! **" );
else GameManager.AddLog( $"** Your excuse is solid. You scrape by the officer. +{scaledMidVal} attack! **" );
player.eventAttackBuff += scaledMidVal;
}
else if ( playerExcuse >= 30 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {player.name}'s excuse causes a stutter, losing composure. -{scaledMidVal} health! **" );
else GameManager.AddLog( $"** Your excuse makes you stutter, you lose composure. -{scaledMidVal} health! **" );
CombatManager.applyDamage( ref player, scaledMidVal );
if ( player.hp < 0 ) player.hp = 0;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"** BUSTED! The officer saw right through {player.name}'s lies and humiliates them! -{scaledHighVal} health and -{scaledHighVal} attack! **" );
else GameManager.AddLog( $"** BUSTED! The officer saw right through your lies and humiliates you! -{scaledHighVal} health and -{scaledHighVal} attack! **" );
player.eventAttackBuff -= scaledHighVal;
CombatManager.applyDamage( ref player, scaledHighVal );
if ( player.hp < 0 ) player.hp = 0;
}
// --- PLAYER 2 RESOLUTION ---
if ( aiExcuse >= 90 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {ai.name}'s excuse was flawless. The officer buys it! +{scaledHighVal} health and +{scaledHighVal} attack! **" );
else GameManager.AddLog( $"** AI delivers a textbook-perfect excuse in binary, the officer buys it. +{scaledHighVal} health and +{scaledHighVal} attack! **" );
ai.eventAttackBuff += scaledHighVal;
ai.hp += scaledHighVal;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
}
else if ( aiExcuse >= 60 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {ai.name}'s excuse is solid, tricking the officer. +{scaledMidVal} attack. **" );
else GameManager.AddLog( $"** AI's excuse sounds robotic, but tricks the officer. +{scaledMidVal} attack. **" );
ai.eventAttackBuff += scaledMidVal;
}
else if ( aiExcuse >= 30 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {ai.name} hits a lag spike mid excuse, officer is suspicious. -{scaledMidVal} health. **" );
else GameManager.AddLog( $"** AI hits a lag spike mid excuse, officer is suspicious. -{scaledMidVal} health. **" );
CombatManager.applyDamage( ref ai, scaledMidVal );
if ( ai.hp < 0 ) ai.hp = 0;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"** BUSTED! {ai.name} starts speaking in 404! Officer puts them in firewall cuffs! -{scaledHighVal} health and attack! **" );
else GameManager.AddLog( $"** BUSTED! The AI starts speaking in 404! Officer puts it in firewall cuffs! -{scaledHighVal} health and attack! **" );
ai.eventAttackBuff -= scaledHighVal;
CombatManager.applyDamage( ref ai, scaledHighVal );
if ( ai.hp < 0 ) ai.hp = 0;
}
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 37:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
// Flat 25 PVP damage for a fair, competitive multiplayer match baseline
int scaledPlayerWinDamage = isMultiplayer ? 25 : 25 + (prestige * 3);
int scaledAIWinDamage = isMultiplayer ? 25 : 10 + (prestige * 3);
var p = player;
var a = ai;
string[] moveNames = { "", "Rock", "Paper", "Scissors" };
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE REGISTERS
// =========================================================================
int p1RPSChoice = 0;
int p2RPSChoice = 0;
bool isRPSResolved = false;
void EvaluateRPSResult( int pMove, int aMove )
{
if ( pMove == aMove )
{
GameManager.AddLog( "** It's a draw! No damage dealt! **" );
}
else if (
(pMove == 1 && aMove == 3) || // Rock beats Scissors
(pMove == 2 && aMove == 1) || // Paper beats Rock
(pMove == 3 && aMove == 2) ) // Scissors beats Paper
{
if ( isMultiplayer ) GameManager.AddLog( $"** {p.name} wins the handshake duel! {a.name} loses {scaledPlayerWinDamage} HP. **" );
else GameManager.AddLog( $"** You win the duel! AI loses {scaledPlayerWinDamage} HP. **" );
CombatManager.applyDamage( ref a, scaledPlayerWinDamage );
if ( a.hp < 0 ) a.hp = 0;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"** {a.name} wins the handshake duel! {p.name} loses {scaledAIWinDamage} HP. **" );
else GameManager.AddLog( $"** AI wins the duel! You lose {scaledAIWinDamage} HP. **" );
CombatManager.applyDamage( ref p, scaledAIWinDamage );
if ( p.hp < 0 ) p.hp = 0;
}
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "** A Rock-Paper-Scissors challenge begins! Both players must lock in their inputs! **" );
GameManager.AddLog( "⚠️ WAITING FOR SYMMETRICAL HANDSHAKE PACKETS..." );
var p1RpsEvent = new ChoiceEvent
{
Title = "✊✋✌️ LIVE HANDSHAKE DUEL",
PromptText = "A reality-bending probability challenge has begun! Choose your tactical vector secretly. Rock crushes Scissors, Paper wraps Rock, Scissors cuts Paper!"
};
// We write a local helper helper inside the button loop to check for the synchronization match
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1RPSChoice = choiceIndex;
else p2RPSChoice = choiceIndex;
// If both players have locked their packets, fire the definitive resolution pass!
if ( p1RPSChoice > 0 && p2RPSChoice > 0 && !isRPSResolved )
{
isRPSResolved = true;
GameManager.AddLog( $"** DUEL PACKETS OVERLOCKED: {p.name} chose {moveNames[p1RPSChoice]}! {a.name} chose {moveNames[p2RPSChoice]}! **" );
EvaluateRPSResult( p1RPSChoice, p2RPSChoice );
// Manually shut down the screen overlays cleanly for both nodes
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their handshake vector! Awaiting opponent payload..." );
}
};
p1RpsEvent.Options.Add( new EventOption { ButtonText = "✊ CHOOSE ROCK", ActionToExecute = () => handleNetworkChoice( 1, Networking.IsHost ) } );
p1RpsEvent.Options.Add( new EventOption { ButtonText = "✋ CHOOSE PAPER", ActionToExecute = () => handleNetworkChoice( 2, Networking.IsHost ) } );
p1RpsEvent.Options.Add( new EventOption { ButtonText = "✌️ CHOOSE SCISSORS", ActionToExecute = () => handleNetworkChoice( 3, Networking.IsHost ) } );
GameManager.Instance.TriggerChoicePopup( p1RpsEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited AI Overlord math rules
int secretAIMove = Random.Shared.Next( 1, 4 );
var rpsEvent = new ChoiceEvent
{
Title = "✊✋✌️ HANDSHAKE DUEL INITIALIZED",
PromptText = "The AI has locked in a tactical data vector. You must counter it using classic manual handshake parameters. Rock crushes Scissors, Paper wraps Rock, Scissors cuts Paper!",
};
rpsEvent.Options.Add( new EventOption
{
ButtonText = "✊ CHOOSE ROCK",
ActionToExecute = () =>
{
GameManager.AddLog( $"** You choose Rock! AI chooses {moveNames[secretAIMove]}! **" );
EvaluateRPSResult( 1, secretAIMove );
}
} );
rpsEvent.Options.Add( new EventOption
{
ButtonText = "✋ CHOOSE PAPER",
ActionToExecute = () =>
{
GameManager.AddLog( $"** You choose Paper! AI chooses {moveNames[secretAIMove]}! **" );
EvaluateRPSResult( 2, secretAIMove );
}
} );
rpsEvent.Options.Add( new EventOption
{
ButtonText = "✌️ CHOOSE SCISSORS",
ActionToExecute = () =>
{
GameManager.AddLog( $"** You choose Scissors! AI chooses {moveNames[secretAIMove]}! **" );
EvaluateRPSResult( 3, secretAIMove );
}
} );
GameManager.Instance.TriggerChoicePopup( rpsEvent );
}
break;
}
case 38:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int scaledNaturalDamage = isMultiplayer ? 30 : 30 + (prestige * 4);
int scaledPointDamage = isMultiplayer ? 25 : 25 + (prestige * 3);
Func<int> rollDice = () =>
{
return (Random.Shared.Next( 6 ) + 1) + (Random.Shared.Next( 6 ) + 1);
};
// =========================================================================
// 🎯 MULTIPLAYER AUTOMATIC SIMULTANEOUS CRAPS DUEL
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "** A symmetrical game of CRAPS begins! Both players throw their dice! **" );
// --- Player 1 Logic ---
int p1Roll = rollDice();
GameManager.AddLog( $"{player.name}'s Come-out roll: {p1Roll}" );
bool p1Won = false;
bool p1Lost = false;
int p1Point = 0;
if ( p1Roll == 7 || p1Roll == 11 ) p1Won = true;
else if ( p1Roll == 2 || p1Roll == 3 || p1Roll == 12 ) p1Lost = true;
else p1Point = p1Roll;
// --- Player 2 Logic ---
int p2Roll = rollDice();
GameManager.AddLog( $"{ai.name}'s Come-out roll: {p2Roll}" );
bool p2Won = false;
bool p2Lost = false;
int p2Point = 0;
if ( p2Roll == 7 || p2Roll == 11 ) p2Won = true;
else if ( p2Roll == 2 || p2Roll == 3 || p2Roll == 12 ) p2Lost = true;
else p2Point = p2Roll;
// Run background rolls for point players
if ( p1Point > 0 )
{
GameManager.AddLog( $"** {player.name}'s point is {p1Point}! Rolling until they hit {p1Point} (win) or 7 (lose). **" );
while ( true )
{
int r = rollDice();
if ( r == p1Point ) { p1Won = true; break; }
if ( r == 7 ) { p1Lost = true; break; }
}
}
if ( p2Point > 0 )
{
GameManager.AddLog( $"** {ai.name}'s point is {p2Point}! Rolling until they hit {p2Point} (win) or 7 (lose). **" );
while ( true )
{
int r = rollDice();
if ( r == p2Point ) { p2Won = true; break; }
if ( r == 7 ) { p2Lost = true; break; }
}
}
// Apply Symmetrical Outcomes
if ( p1Won ) { GameManager.AddLog( $"** {player.name} HITS THE POINT / NATURAL! {ai.name} takes -{scaledNaturalDamage} HP! **" ); CombatManager.applyDamage( ref ai, scaledNaturalDamage ); }
if ( p1Lost ) { GameManager.AddLog( $"** {player.name} CRAPS OUT / SEVEN-OUT! Taking -{scaledPointDamage} HP! **" ); CombatManager.applyDamage( ref player, scaledPointDamage ); }
if ( p2Won ) { GameManager.AddLog( $"** {ai.name} HITS THE POINT / NATURAL! {player.name} takes -{scaledNaturalDamage} HP! **" ); CombatManager.applyDamage( ref player, scaledNaturalDamage ); }
if ( p2Lost ) { GameManager.AddLog( $"** {ai.name} CRAPS OUT / SEVEN-OUT! Taking -{scaledPointDamage} HP! **" ); CombatManager.applyDamage( ref ai, scaledPointDamage ); }
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
}
else
{
// 🤖 SINGLE PLAYER: Legacy un-edited career loops
GameManager.AddLog( "** A game of CRAPS begins! **" );
GameManager.AddLog( "You roll two dice..." );
int rollVal = rollDice();
GameManager.AddLog( $"Come-out roll: {rollVal}" );
if ( rollVal == 7 || rollVal == 11 )
{
GameManager.AddLog( $"** NATURAL! You win instantly! AI loses {scaledNaturalDamage}HP! **" );
CombatManager.applyDamage( ref ai, scaledNaturalDamage );
if ( ai.hp < 0 ) ai.hp = 0;
}
else if ( rollVal == 2 || rollVal == 3 || rollVal == 12 )
{
GameManager.AddLog( $"** CRAPS! You lose instantly! You take {scaledNaturalDamage} HP damage! **" );
CombatManager.applyDamage( ref player, scaledNaturalDamage );
if ( player.hp < 0 ) player.hp = 0;
}
else
{
int point = rollVal;
GameManager.AddLog( $"** Your point is {point}! Keep rolling until you hit {point} again (win) or 7 (lose). **" );
while ( true )
{
rollVal = rollDice();
GameManager.AddLog( $"You rolled: {rollVal}" );
if ( rollVal == point )
{
GameManager.AddLog( $"** You hit your point! You WIN! AI loses {scaledPointDamage} HP. **" );
CombatManager.applyDamage( ref ai, scaledPointDamage );
if ( ai.hp < 0 ) ai.hp = 0;
break;
}
else if ( rollVal == 7 )
{
GameManager.AddLog( $"** Seven-out! You lose! -{scaledPointDamage} HP. **" );
CombatManager.applyDamage( ref player, scaledPointDamage );
if ( player.hp < 0 ) player.hp = 0;
break;
}
}
}
}
// =========================================================================
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 39:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
if ( isMultiplayer ) GameManager.AddLog( $"\n Both {player.name} and {ai.name} open up your dating apps" );
else GameManager.AddLog( "\n Both you and the AI open up your dating apps" );
int playerMatches = Random.Shared.Next( 22 );
int aiMatches = Random.Shared.Next( 22 );
GameManager.AddLog( $"{player.name} matched with {playerMatches} matches." );
GameManager.AddLog( $"{ai.name} matched with {aiMatches} matches." );
if ( playerMatches > aiMatches )
{
int prestigeMultiplier = isMultiplayer ? 2 : 2 + prestige;
int damage = (playerMatches - aiMatches) * prestigeMultiplier;
CombatManager.applyDamage( ref ai, damage );
if ( ai.hp < 0 ) ai.hp = 0;
if ( isMultiplayer ) GameManager.AddLog( $"** {player.name} is irresistible! {ai.name} loses {damage} HP from crushing loneliness! **" );
else GameManager.AddLog( $"You're irresistible! AI loses {damage} HP from crushing loneliness!" );
}
else if ( aiMatches > playerMatches )
{
int prestigeMultiplier = isMultiplayer ? 2 : 2 + prestige;
int damage = (aiMatches - playerMatches) * prestigeMultiplier;
CombatManager.applyDamage( ref player, damage );
if ( player.hp < 0 ) player.hp = 0;
if ( isMultiplayer ) GameManager.AddLog( $"** {ai.name}'s profile is on fire! {player.name} loses {damage} HP from rejection! **" );
else GameManager.AddLog( $"AI's profile is on fire! You lose {damage} HP from rejection!" );
}
else
{
int scaledTieDamage = isMultiplayer ? 5 : 5 + (prestige * 1);
CombatManager.applyDamage( ref player, scaledTieDamage );
CombatManager.applyDamage( ref ai, scaledTieDamage );
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
GameManager.AddLog( $"You both got the same matches, both are bitter. Both lose {scaledTieDamage} HP." );
}
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 40:
{
DiceDuelEventRunner.StartEvent( player, ai );
break;
}
case 41:
{
BlackjackEventRunner.StartEvent( player, ai );
break;
}
case 42:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
// Fetch current real-time health values for the logs and damage injection
int currentRoundPlayerHp = player.hp;
int currentRoundAIHp = ai.hp;
int scaledStressDamage = isMultiplayer ? 25 : 25 + (prestige * 3);
GameManager.AddLog( "** Russian Roulette begins! **" );
// =========================================================================
// 🎯 MULTIPLAYER HIGH-STAKES SEQUENTIAL ROULLETE DUEL
// =========================================================================
if ( isMultiplayer )
{
// Roll a 50/50 chance to determine who is forced to go first this turn
ref Player firstShooter = ref player;
ref Player secondShooter = ref ai;
int firstShooterHp = currentRoundPlayerHp;
int secondShooterHp = currentRoundAIHp;
if ( Random.Shared.Next( 2 ) == 0 )
{
firstShooter = ref ai;
secondShooter = ref player;
firstShooterHp = currentRoundAIHp;
secondShooterHp = currentRoundPlayerHp;
}
// --- FIRST SHOOTER STAGE ---
int bulletPos1 = Random.Shared.Next( 6 );
int chamber1 = Random.Shared.Next( 6 );
GameManager.AddLog( $"Bullet is in chamber: {bulletPos1 + 1}" );
GameManager.AddLog( $"** {firstShooter.name} pulls the trigger - Chamber {chamber1 + 1} fires! **" );
if ( chamber1 == bulletPos1 )
{
GameManager.AddLog( $"💥 BANG! {firstShooter.name} takes -{firstShooterHp} HP (Fatal Damage!)" );
CombatManager.applyDamage( ref firstShooter, firstShooterHp );
}
else
{
GameManager.AddLog( $"*CLICK* {firstShooter.name} survived! {secondShooter.name} takes {scaledStressDamage} HP from stress!" );
CombatManager.applyDamage( ref secondShooter, scaledStressDamage );
}
// --- SECOND SHOOTER STAGE (Only if they survived the stress or a misfire) ---
if ( secondShooter.hp > 0 )
{
int bulletPos2 = Random.Shared.Next( 6 );
int chamber2 = Random.Shared.Next( 6 );
GameManager.AddLog( $"** {secondShooter.name} pulls the trigger - Chamber {chamber2 + 1} fires! **" );
if ( chamber2 == bulletPos2 )
{
GameManager.AddLog( $"💥 BANG! {secondShooter.name} takes -{secondShooter.hp} HP (Fatal Damage!)" );
CombatManager.applyDamage( ref secondShooter, secondShooter.hp );
}
else
{
GameManager.AddLog( $"*CLICK* {secondShooter.name} survived! {firstShooter.name} takes {scaledStressDamage} HP from stress!" );
CombatManager.applyDamage( ref firstShooter, scaledStressDamage );
}
}
}
else
{
// 🤖 SINGLE PLAYER: Legacy un-edited behavior and text structures
int bulletPos = Random.Shared.Next( 6 );
int chamber = Random.Shared.Next( 6 );
GameManager.AddLog( $"Bullet is in chamber: {bulletPos + 1}" );
GameManager.AddLog( $"You pull the trigger - Chamber {chamber + 1} fires!" );
if ( chamber == bulletPos )
{
GameManager.AddLog( $"💥 BANG! -{currentRoundPlayerHp} HP (Fatal Damage!)" );
CombatManager.applyDamage( ref player, currentRoundPlayerHp );
}
else
{
GameManager.AddLog( $"*CLICK* You survived! AI takes {scaledStressDamage} HP from stress!" );
CombatManager.applyDamage( ref ai, scaledStressDamage );
}
if ( ai.hp > 0 )
{
bulletPos = Random.Shared.Next( 6 );
chamber = Random.Shared.Next( 6 );
GameManager.AddLog( $"AI pulls the trigger - Chamber {chamber + 1} fires!" );
if ( chamber == bulletPos )
{
GameManager.AddLog( $"💥 BANG! AI takes -{currentRoundAIHp} HP (Fatal Damage!)" );
CombatManager.applyDamage( ref ai, currentRoundAIHp );
}
else
{
GameManager.AddLog( $"*CLICK* AI survived! You take {scaledStressDamage} HP from stress!" );
CombatManager.applyDamage( ref player, scaledStressDamage );
}
}
}
// =========================================================================
break;
}
case 43:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int prestigeBonus = isMultiplayer ? 0 : prestige * 3;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref ai;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref player; // Downpour targets Player 1 instead of Player 2!
}
// =========================================================================
GameManager.AddLog( "** The skies darken -- clouds gather overhead! **" );
int weatherRoll = Random.Shared.Next( 1, 101 );
if ( weatherRoll <= 50 )
{
int baseDamage = Random.Shared.Next( 10, 31 ); // 10 to 30 base
int scaledStormDamage = baseDamage + prestigeBonus;
if ( isMultiplayer )
{
GameManager.AddLog( $"** A sudden downpour strikes {target.name}! **" );
GameManager.AddLog( $"{target.name} takes {scaledStormDamage} HP from the storm!" );
}
else
{
GameManager.AddLog( "** A sudden downpour strikes the AI! **" );
GameManager.AddLog( $"AI takes {scaledStormDamage} HP from the storm!" );
}
CombatManager.applyDamage( ref target, scaledStormDamage );
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"** {target.name} must be waterproof! The storm passes, no HP taken. **" );
else GameManager.AddLog( "This AI's model must be waterproof! The storm passes, no HP taken." );
}
GameManager.AddLog( $"{target.name} | HP: {target.hp} | Armor: {target.defense}" );
break;
}
case 44:
{
MontyHallEventRunner.StartEvent( player, ai );
break;
}
case 45:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
GameManager.AddLog( "\n** A Gunslinger Duel Begins! **" );
GameManager.AddLog( "Standoff... draw on the count of three." );
// Capture exact active mid-game health snapshots
int currentRoundPlayerHp = player.hp;
int currentRoundAIHp = ai.hp;
const int BOTH_MISS_PCT = 5;
const int PLAYER_ONLY_MISS = 12;
const int AI_ONLY_MISS = 12;
const int MUTUAL_KILL_PCT = 3;
int r = Random.Shared.Next( 1, 101 );
GameManager.AddLog( $"(Chance roll = {r})" );
if ( r <= BOTH_MISS_PCT )
{
GameManager.AddLog( "** Both shooters fire and miss! Dust settles. No damage! **" );
}
else if ( r <= BOTH_MISS_PCT + PLAYER_ONLY_MISS )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"** {player.name} fumbles the draw and misses! {ai.name}'s bullet lands true. **" );
GameManager.AddLog( $"BANG! {player.name} takes -{currentRoundPlayerHp}HP (Lethal Execution!)" );
}
else
{
GameManager.AddLog( "** You fumble the draw - you miss! The AI's bullet finds you. **" );
GameManager.AddLog( $"BANG! You take -{currentRoundPlayerHp}HP (Lethal Execution!)" );
}
CombatManager.applyDamage( ref player, currentRoundPlayerHp );
}
else if ( r <= BOTH_MISS_PCT + PLAYER_ONLY_MISS + AI_ONLY_MISS )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"** {ai.name} fumbles the draw and misses! {player.name}'s bullet lands true! **" );
GameManager.AddLog( $"BANG! {ai.name} takes -{currentRoundAIHp}HP (Lethal Execution!)" );
}
else
{
GameManager.AddLog( "** The AI calculated the angle of its aim incorrectly - it misses! Your shot lands true! **" );
GameManager.AddLog( $"BANG! AI takes -{currentRoundAIHp}HP (Lethal Execution!)" );
}
CombatManager.applyDamage( ref ai, currentRoundAIHp );
}
else if ( r <= BOTH_MISS_PCT + PLAYER_ONLY_MISS + AI_ONLY_MISS + MUTUAL_KILL_PCT )
{
GameManager.AddLog( "** A brutal finale! Both guns fire true at the same instant! **" );
GameManager.AddLog( $"BANG! BANG! Both duelists fall! (-{currentRoundPlayerHp} HP / -{currentRoundAIHp} HP)" );
CombatManager.applyDamage( ref player, currentRoundPlayerHp );
CombatManager.applyDamage( ref ai, currentRoundAIHp );
}
else
{
int playerSkill = 0;
int aiSkill = 0;
int playerQuick = Random.Shared.Next( 1, 101 ) + playerSkill;
int aiQuick = Random.Shared.Next( 1, 101 ) + aiSkill;
GameManager.AddLog( "** Quickdraw! **" );
GameManager.AddLog( $"{player.name} quickdraw roll: {playerQuick}" );
GameManager.AddLog( $"{ai.name} quickdraw roll: {aiQuick}" );
if ( playerQuick > aiQuick )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {player.name}'s shot is faster and lands accurate! {ai.name} takes -{currentRoundAIHp}HP! **" );
else GameManager.AddLog( $"** Your shot is faster and lands accurate! AI takes -{currentRoundAIHp}HP! **" );
CombatManager.applyDamage( ref ai, currentRoundAIHp );
}
else if ( aiQuick > playerQuick )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {ai.name}'s shot is faster and lands accurate! {player.name} takes -{currentRoundPlayerHp}HP! **" );
else GameManager.AddLog( $"** The AI's shot is faster and lands accurate! You take -{currentRoundPlayerHp}HP! **" );
CombatManager.applyDamage( ref player, currentRoundPlayerHp );
}
else
{
GameManager.AddLog( "** It's a dead heat - both fire at the same instant and miss! **" );
}
}
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 46:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int activePrestige = isMultiplayer ? 0 : prestige;
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
// Symmetrically rolls a 50/50 chance to determine who receives the popup modal
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai;
}
int maxTargetHp = target.maxHp;
// =========================================================================
// Scale rewards and trap damage lineally (+4 per prestige level)
int totalChestHeal = 20 + (activePrestige * 4) + target.eventHealingBuff;
int scaledChestTrap = 20 + (activePrestige * 4);
var p = target;
int hiddenTreasureChest = Random.Shared.Next( 1, 4 );
void OpenTargetChest( int playerChoice, string chestName )
{
if ( isMultiplayer ) GameManager.AddLog( $"{p.name} decides to open the {chestName}." );
else GameManager.AddLog( $"You decide to open the {chestName}." );
if ( playerChoice == hiddenTreasureChest )
{
if ( isMultiplayer ) GameManager.AddLog( $"{p.name} found a stash of potions! +{totalChestHeal} HP!" );
else GameManager.AddLog( $"You found a stash of potions! +{totalChestHeal} HP!" );
p.hp += totalChestHeal;
if ( p.hp > maxTargetHp ) p.hp = maxTargetHp;
p.eventHealingBuff = 0;
}
else if ( Random.Shared.Next( 0, 2 ) == 0 )
{
if ( isMultiplayer ) GameManager.AddLog( $"It's a trap! Poison darts hit {p.name}! -{scaledChestTrap}HP!" );
else GameManager.AddLog( $"It's a trap! Poison darts hit you! -{scaledChestTrap}HP!" );
CombatManager.applyDamage( ref p, scaledChestTrap );
}
else
{
GameManager.AddLog( "The chest is empty. Nothing happens..." );
}
if ( p.hp < 0 ) p.hp = 0;
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
}
var chestEvent = new ChoiceEvent
{
Title = "📦 MAINFRAME TREASURE GAMBLE",
PromptText = isMultiplayer
? $"Three encrypted logic storage chests have materialized near {p.name}. Choose your extraction pathway:"
: "Three encrypted logic storage chests have materialized on the terminal network layer. One contains data-potions, another contains a poison dart loop routine, and the last is completely empty. Choose your extraction pathway:",
};
// --- BUTTON 1: GOLDEN CHEST ---
chestEvent.Options.Add( new EventOption
{
ButtonText = "👑 OPEN GOLDEN CHEST",
ActionToExecute = () =>
{
OpenTargetChest( 1, "Golden Chest" );
}
} );
// --- BUTTON 2: SILVER CHEST ---
chestEvent.Options.Add( new EventOption
{
ButtonText = "🛡️ OPEN SILVER CHEST",
ActionToExecute = () =>
{
OpenTargetChest( 2, "Silver Chest" );
}
} );
// --- BUTTON 3: WOODEN CHEST ---
chestEvent.Options.Add( new EventOption
{
ButtonText = "🪵 OPEN WOODEN CHEST",
ActionToExecute = () =>
{
OpenTargetChest( 3, "Wooden Chest" );
}
} );
// Broadcast setup warnings across the system logs
if ( isMultiplayer )
{
GameManager.AddLog( $"** Treasure Chest Gamble! Three chests appear near {p.name}.. **" );
}
else
{
GameManager.AddLog( "** Treasure Chest Gamble! **" );
GameManager.AddLog( "Three chests appear before you.." );
GameManager.AddLog( "⚠️ AWAITING TREASURE STORAGE PARM INTERACTION..." );
}
// Fires the popup layer and freezes tactical move sequencing until resolved
if ( isMultiplayer )
{
if ( (target == player && Networking.IsHost) || (target == ai && !Networking.IsHost) )
{
GameManager.Instance.TriggerChoicePopup( chestEvent );
}
else
{
GameManager.AddLog( $"⏳ Waiting for {p.name} to pick a chest array configuration..." );
}
}
else
{
GameManager.Instance.TriggerChoicePopup( chestEvent );
}
break;
}
case 47:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Gentle scaling multiplier for ore stats (+1 to +2 per prestige tier) (Gated for Single-Player)
int pStatBonus = isMultiplayer ? 0 : prestige * 1;
if ( isMultiplayer )
{
GameManager.AddLog( "** A glittering seam of ore suddenly erupts from the ground! **" );
GameManager.AddLog( $"** {player.name} and {ai.name} rush forward to grab what you can... **\n" );
}
else
{
GameManager.AddLog( "** A glittering seam of ore suddenly erupts from the ground! **" );
GameManager.AddLog( "You and the AI rush forward to grab what you can..\n" );
}
List<Ore> ores = new List<Ore>
{
new Ore("Coal", 12, 0, 0, 0, "Just a lump of coal.. better than nothing."),
new Ore("Copper", 10, 5 + pStatBonus, 1 + pStatBonus, 0, "Soft and reddish. A touch of energy."),
new Ore("Iron", 10, 10 + pStatBonus, 2 + pStatBonus, 0, "Solid and dependable."),
new Ore("Tin", 8, 3 + pStatBonus, 0, 1 + pStatBonus, "A softer metal. Grants minor reinforcement."),
new Ore("Silver", 6, 12 + pStatBonus, 3 + pStatBonus, 1 + pStatBonus, "Shining silver - power surges a little."),
new Ore("Gold", 5, 20 + pStatBonus, 4 + pStatBonus, 0, "The classic treasure. Feels invigorating."),
new Ore("Obsidian", 4, 0, 6 + pStatBonus, 0, "Sharp volcanic glass - dangerous in hand."),
new Ore("Mithril", 3, 15 + pStatBonus, 3 + pStatBonus, 3 + pStatBonus, "Light, strong, and legendary."),
new Ore("Adamantine", 2, 25 + pStatBonus, 6 + pStatBonus, 4 + pStatBonus, "A mythic ore - your body feels reinforced."),
new Ore("Dragonstone", 1, 30 + pStatBonus, 8 + pStatBonus, 0, "It pulses like fire. Incredible strength!"),
new Ore("Aetherite", 1, 40 + pStatBonus, 10 + pStatBonus, 5 + pStatBonus, "Other worldly. Reality bends at your touch!")
};
Ore PickOre()
{
int totalWeight = 0;
foreach ( var o in ores ) totalWeight += o.Weight;
int r = Random.Shared.Next( totalWeight );
int running = 0;
foreach ( var o in ores )
{
running += o.Weight;
if ( r < running )
return o;
}
return ores[ores.Count - 1];
}
Ore playerOre = PickOre();
Ore aiOre = PickOre();
if ( isMultiplayer )
{
GameManager.AddLog( $">> {player.name} found {playerOre.Name}! {playerOre.Flavor}" );
GameManager.AddLog( $">> {ai.name} found {aiOre.Name}! {aiOre.Flavor}\n" );
}
else
{
GameManager.AddLog( $">> You found {playerOre.Name}! {playerOre.Flavor}" );
GameManager.AddLog( $">> AI found {aiOre.Name}! {aiOre.Flavor}\n" );
}
// --- PLAYER 1 OUTCOMES ---
if ( playerOre.Heal > 0 )
{
int totalPlayerHeal = playerOre.Heal + player.eventHealingBuff;
player.hp += totalPlayerHeal;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
player.eventHealingBuff = 0; // Safe flush
GameManager.AddLog( $"{player.name} heals +{totalPlayerHeal} HP." );
}
if ( playerOre.Attack > 0 )
{
player.eventAttackBuff += playerOre.Attack;
GameManager.AddLog( $"{player.name}'s attacks grow stronger! (+{playerOre.Attack})" );
}
if ( playerOre.Defense > 0 )
{
player.eventAttackBuff += playerOre.Defense;
GameManager.AddLog( $"{player.name}'s defenses feel sturdier! (+{playerOre.Defense} attack next turn)" );
}
// --- PLAYER 2 OUTCOMES ---
if ( aiOre.Heal > 0 )
{
int totalAIHeal = aiOre.Heal + ai.eventHealingBuff;
ai.hp += totalAIHeal;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
ai.eventHealingBuff = 0; // Safe flush
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name} heals +{totalAIHeal} HP." );
else GameManager.AddLog( $"AI heals +{totalAIHeal} HP." );
}
if ( aiOre.Attack > 0 )
{
ai.eventAttackBuff += aiOre.Attack;
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name}'s attacks grow stronger! (+{aiOre.Attack})" );
else GameManager.AddLog( $"AI's attacks grow stronger! (+{aiOre.Attack})" );
}
if ( aiOre.Defense > 0 )
{
ai.eventAttackBuff += aiOre.Defense;
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name} braces itself with new strength! (+{aiOre.Defense} attack next turn)" );
else GameManager.AddLog( $"AI braces itself with new strength! (+{aiOre.Defense} attack next turn)" );
}
GameManager.AddLog( "\nThe seam collapses back into the ground. The fight continues!" );
break;
}
case 48:
{
GameManager.AddLog( "\n=== RANDOM EVENT ===" );
GameManager.AddLog( "** A horde of ZOMBIES shambles into the arena! **" );
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Scale wound and vector reward properties (+4 to +5 per prestige level)
int scaledWoundDamage = isMultiplayer ? 30 : 30 + (prestige * 4);
// Integrate any active temporary healing buffs directly onto the survival reward calculations
int totalVictoryHealPlayer = 20 + (isMultiplayer ? 0 : (prestige * 4)) + player.eventHealingBuff;
int totalVictoryHealAI = 20 + (isMultiplayer ? 0 : (prestige * 4)) + ai.eventHealingBuff;
int scaledVictoryBuff = isMultiplayer ? 10 : 10 + (prestige * 2);
int hordeSize = Random.Shared.Next( 1, 6 ); // 1 to 5 scale.
GameManager.AddLog( $"The horde size is: {hordeSize} (1 = tiny, 5 = massive)" );
int baseDeathChance = 5;
int baseWoundChance = 15;
int deathChance = baseDeathChance * hordeSize;
int woundChance = baseWoundChance * hordeSize;
if ( deathChance > 60 ) deathChance = 60;
if ( woundChance > 70 ) woundChance = 70;
int playerRoll = Random.Shared.Next( 100 );
int aiRoll = Random.Shared.Next( 100 );
bool playerAlive = true;
bool aiAlive = true;
// Player 1 outcome
if ( playerRoll < deathChance )
{
if ( isMultiplayer ) GameManager.AddLog( $"The zombies overwhelm {player.name}! They're torn apart!" );
else GameManager.AddLog( "The zombies overwhelm YOU! You're torn apart!" );
player.hp = 0;
playerAlive = false;
}
else if ( playerRoll < deathChance + woundChance )
{
if ( isMultiplayer ) GameManager.AddLog( $"{player.name} got clawed up and bitten! -{scaledWoundDamage} HP!" );
else GameManager.AddLog( $"You got clawed up and bitten! -{scaledWoundDamage} HP!" );
CombatManager.applyDamage( ref player, scaledWoundDamage );
if ( player.hp < 0 ) player.hp = 0;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"{player.name} fights the zombies off bravely!" );
else GameManager.AddLog( "You fight the zombies off bravely!" );
}
// Player 2 / AI outcome
if ( aiRoll < deathChance )
{
if ( isMultiplayer ) GameManager.AddLog( $"The zombies swarm {ai.name}! They're torn apart!" );
else GameManager.AddLog( "The zombies swarm the AI! Circuits and machine parts fly everywhere!" );
ai.hp = 0;
aiAlive = false;
}
else if ( aiRoll < deathChance + woundChance )
{
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name} takes heavy damage! -{scaledWoundDamage} HP!" );
else GameManager.AddLog( $"The AI takes heavy damage! -{scaledWoundDamage} HP!" );
CombatManager.applyDamage( ref ai, scaledWoundDamage );
if ( ai.hp < 0 ) ai.hp = 0;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name} crushes zombies with relentless force!" );
else GameManager.AddLog( "The AI crushes zombies with relentless force!" );
}
// Reward if both survive
if ( playerAlive && aiAlive )
{
if ( isMultiplayer ) GameManager.AddLog( $"\n{player.name} and {ai.name} stand victorious after the horde!" );
else GameManager.AddLog( "\nYou and the AI stand victorious after the horde!" );
player.hp += totalVictoryHealPlayer;
ai.hp += totalVictoryHealAI;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
player.eventAttackBuff += scaledVictoryBuff;
ai.eventAttackBuff += scaledVictoryBuff;
player.eventHealingBuff = 0;
ai.eventHealingBuff = 0;
if ( isMultiplayer ) GameManager.AddLog( $"Both gain +{totalVictoryHealPlayer} HP ({ai.name}: +{totalVictoryHealAI} HP) and +{scaledVictoryBuff} attack!" );
else GameManager.AddLog( $"Both gain +{totalVictoryHealPlayer} HP (AI: +{totalVictoryHealAI} HP) and +{scaledVictoryBuff} attack!" );
}
GameManager.AddLog( "The battlefield is littered with corpses!" );
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 49:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Calculate scaled reward/risk modifiers (Flattened to baseline for multiplayer matches)
int fireBonusBase = 5 + ((isMultiplayer ? 0 : prestige) * 1);
int fireBonusInfr = 15 + ((isMultiplayer ? 0 : prestige) * 2);
int fireBurnDmg = 10 + ((isMultiplayer ? 0 : prestige) * 2);
int lightBonus = 10 + ((isMultiplayer ? 0 : prestige) * 2);
int lightBackfire = 20 + ((isMultiplayer ? 0 : prestige) * 3);
int iceBonusBase = 5 + ((isMultiplayer ? 0 : prestige) * 1);
int iceBonusSkin = 20 + ((isMultiplayer ? 0 : prestige) * 3);
int iceFrostbite = 8 + ((isMultiplayer ? 0 : prestige) * 1);
int earthFortitude = 30 + ((isMultiplayer ? 0 : prestige) * 5);
int earthCrushed = 25 + ((isMultiplayer ? 0 : prestige) * 4);
var p = player;
var a = ai;
string[] orbNames = { "", "FIRE ORB", "LIGHTNING ORB", "ICE ORB", "EARTH ORB" };
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE PROTOCOLS
// =========================================================================
int p1OrbChoice = 0;
int p2OrbChoice = 0;
bool isOrbResolved = false;
void ApplyOrb( string name, int orb, Player target, int targetMaxHp )
{
int luck = Random.Shared.Next( 0, 100 ); // 0 to 99 inclusive
switch ( orb )
{
case 1: // Fire
GameManager.AddLog( $"🔥 {name} grabs the **FIRE ORB**" );
target.eventAttackBuff += fireBonusBase;
if ( luck < 70 )
{
GameManager.AddLog( $"🔥 {name} grabs the burning inferno! +{fireBonusInfr} attack!" );
target.eventAttackBuff += fireBonusInfr;
}
else
{
GameManager.AddLog( $"💥 {name} is burned from the untamed orb! -{fireBurnDmg} HP!" );
target.hp -= fireBurnDmg;
}
break;
case 2: // Lightning
GameManager.AddLog( $"⚡ {name} grabs the **LIGHTNING ORB**" );
if ( luck < 80 )
{
GameManager.AddLog( $"⚡ {name} becomes charged! +{lightBonus} attack and energy buffers expanded!" );
target.eventAttackBuff += lightBonus;
target.eventAttackBuff += lightBonus;
}
else
{
GameManager.AddLog( $"💥 A thunderbolt loses control and backfires on {name}! -{lightBackfire} HP!" );
target.hp -= lightBackfire;
}
break;
case 3: // Ice
GameManager.AddLog( $"❄️ {name} holds the **ICE ORB**" );
GameManager.AddLog( $"❄️ {name} stiffens to reduce attack impact! +{iceBonusBase} defense!" );
target.eventAttackBuff += iceBonusBase;
if ( luck < 60 )
{
GameManager.AddLog( $"❄️ {name}'s skin solidifies like ice! +{iceBonusSkin} defense!" );
target.eventAttackBuff += iceBonusSkin;
}
else
{
GameManager.AddLog( $"💥 {name} freezes their fingers, frostbite! -{iceFrostbite} HP!" );
target.hp -= iceFrostbite;
}
break;
case 4: // Earth
GameManager.AddLog( $"🪨 {name} scoops up the **EARTH ORB**" );
if ( luck < 90 )
{
int totalEarthHeal = earthFortitude + target.eventHealingBuff;
GameManager.AddLog( $"🪨 {name} gains the grounds fortitude! +{totalEarthHeal} HP!" );
target.hp += totalEarthHeal;
target.eventHealingBuff = 0;
}
else
{
GameManager.AddLog( $"💥 {name} is crushed by the weight of dirt and stone! -{earthCrushed} HP!" );
target.hp -= earthCrushed;
}
break;
}
if ( target.hp > targetMaxHp ) target.hp = targetMaxHp;
if ( target.hp < 0 ) target.hp = 0;
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== ELEMENTAL ORBS APPEAR ===" );
GameManager.AddLog( "Four glowing orbs rise from the ground... Both players must lock their matrices!" );
GameManager.AddLog( "⚠️ AWAITING ELEMENTAL MATRICES SELECTION..." );
var multiplayerOrbEvent = new ChoiceEvent
{
Title = "🔮 ELEMENTAL MATRICES MANIFESTATION",
PromptText = "Four luminous data-orbs have risen through the hardware chassis partitions. Choose your matrix:",
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1OrbChoice = choiceIndex;
else p2OrbChoice = choiceIndex;
if ( p1OrbChoice > 0 && p2OrbChoice > 0 && !isOrbResolved )
{
isOrbResolved = true;
GameManager.AddLog( $"\n🔮 [MATRICES OVERCLOCK] Symmetrical handshakes received!" );
ApplyOrb( p.name, p1OrbChoice, p, maxPlayerHp );
ApplyOrb( a.name, p2OrbChoice, a, maxAIHp );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their orb element selection payload!" );
}
};
multiplayerOrbEvent.Options.Add( new EventOption { ButtonText = "🔥 HARNESS FIRE ORB", ActionToExecute = () => handleNetworkChoice( 1, Networking.IsHost ) } );
multiplayerOrbEvent.Options.Add( new EventOption { ButtonText = "⚡ HARNESS LIGHTNING ORB", ActionToExecute = () => handleNetworkChoice( 2, Networking.IsHost ) } );
multiplayerOrbEvent.Options.Add( new EventOption { ButtonText = "❄️ HARNESS ICE ORB", ActionToExecute = () => handleNetworkChoice( 3, Networking.IsHost ) } );
multiplayerOrbEvent.Options.Add( new EventOption { ButtonText = "🪨 HARNESS EARTH ORB", ActionToExecute = () => handleNetworkChoice( 4, Networking.IsHost ) } );
GameManager.Instance.TriggerChoicePopup( multiplayerOrbEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career rules
GameManager.AddLog( "\n=== ELEMENTAL ORBS APPEAR ===" );
GameManager.AddLog( "Four glowing orbs rise from the ground..." );
GameManager.AddLog( "⚠️ AWAITING ELEMENTAL MATRICES SELECTION..." );
int secretAIChoice = Random.Shared.Next( 1, 5 );
var orbEvent = new ChoiceEvent
{
Title = "🔮 ELEMENTAL MATRICES MANIFESTATION",
PromptText = "Four luminous data-orbs have risen through the hardware chassis partitions. Each holds high-potency code modifications wrapped in volatile side-effect variables. Choose your download matrix:",
};
void FinalizeOrbDuels( int playerChoice )
{
ApplyOrb( "Player", playerChoice, p, maxPlayerHp );
ApplyOrb( "AI", secretAIChoice, a, maxAIHp );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
orbEvent.Options.Add( new EventOption { ButtonText = "🔥 HARNESS FIRE ORB", ActionToExecute = () => { FinalizeOrbDuels( 1 ); } } );
orbEvent.Options.Add( new EventOption { ButtonText = "⚡ HARNESS LIGHTNING ORB", ActionToExecute = () => { FinalizeOrbDuels( 2 ); } } );
orbEvent.Options.Add( new EventOption { ButtonText = "❄️ HARNESS ICE ORB", ActionToExecute = () => { FinalizeOrbDuels( 3 ); } } );
orbEvent.Options.Add( new EventOption { ButtonText = "🪨 HARNESS EARTH ORB", ActionToExecute = () => { FinalizeOrbDuels( 4 ); } } );
GameManager.Instance.TriggerChoicePopup( orbEvent );
}
break;
}
case 50:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
// Calculate scaled bonus stats lineally (Flattened to baseline for competitive multiplayer)
int scaledAttackBonus = 5 + ((isMultiplayer ? 0 : prestige) * 2);
int scaledDefBonus = 5 + ((isMultiplayer ? 0 : prestige) * 2);
int scaledRecoilDmg = 10 + ((isMultiplayer ? 0 : prestige) * 2);
var p = player;
var a = ai;
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE PROTOCOLS
// =========================================================================
int p1VaultChoice = 0;
int p2VaultChoice = 0;
bool isVaultResolved = false;
void GiveWeapon( string name, int pick, Player target )
{
switch ( pick )
{
case 1:
GameManager.AddLog( $"🔥 {name} equips the **Flame Blade**" );
target.eventAttackBuff += (15 + scaledAttackBonus);
break;
case 2:
GameManager.AddLog( $"❄️ {name} equips the **Frost Hammer**" );
target.eventAttackBuff += (10 + scaledAttackBonus);
target.eventAttackBuff += (5 + scaledDefBonus);
break;
case 3:
GameManager.AddLog( $"⚡ {name} equips the **Volt Dagger**" );
target.eventAttackBuff += (20 + scaledAttackBonus);
if ( Random.Shared.Next( 0, 100 ) < 50 )
{
GameManager.AddLog( $"💥 The dagger shocks {name}! -{scaledRecoilDmg} HP recoil!" );
target.hp -= scaledRecoilDmg;
}
break;
case 4:
GameManager.AddLog( $"🪨 {name} equips the **Stone Shield**" );
target.eventAttackBuff += (25 + scaledDefBonus);
break;
}
if ( target.hp < 0 ) target.hp = 0;
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== WEAPON VAULT EVENT ===" );
GameManager.AddLog( "A floating vault opens, revealing 4 weapons. Both players must choose a weapon slice!" );
GameManager.AddLog( "⚠️ AWAITING HARDWARE DATA OVERCLOCK LINK..." );
var multiplayerVaultEvent = new ChoiceEvent
{
Title = "🛡️ CRYPTO WEAPON VAULT OVERRIDE",
PromptText = "A floating digital armor vault has materialized in the core matrix workspace. Select your download slice:",
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1VaultChoice = choiceIndex;
else p2VaultChoice = choiceIndex;
if ( p1VaultChoice > 0 && p2VaultChoice > 0 && !isVaultResolved )
{
isVaultResolved = true;
GameManager.AddLog( $"\n🛡️ [VAULT EXTRACTION OUTCOME] Symmetrical data overclocks synchronized!" );
GiveWeapon( p.name, p1VaultChoice, p );
GiveWeapon( a.name, p2VaultChoice, a );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a} | HP: {a.hp} | Armor: {a.defense}" );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their armor vault hardware selection!" );
}
};
multiplayerVaultEvent.Options.Add( new EventOption { ButtonText = $"🔥 EQUIP FLAME BLADE (+{15 + scaledAttackBonus} ATK)", ActionToExecute = () => handleNetworkChoice( 1, Networking.IsHost ) } );
multiplayerVaultEvent.Options.Add( new EventOption { ButtonText = $"❄️ EQUIP FROST HAMMER (+{10 + scaledAttackBonus} ATK, +{5 + scaledDefBonus} DEF)", ActionToExecute = () => handleNetworkChoice( 2, Networking.IsHost ) } );
multiplayerVaultEvent.Options.Add( new EventOption { ButtonText = $"⚡ EQUIP VOLT DAGGER (+{20 + scaledAttackBonus} ATK, 50% -{scaledRecoilDmg} HP RECOIL)", ActionToExecute = () => handleNetworkChoice( 3, Networking.IsHost ) } );
multiplayerVaultEvent.Options.Add( new EventOption { ButtonText = $"🪨 EQUIP STONE SHIELD (+{25 + scaledDefBonus} DEF)", ActionToExecute = () => handleNetworkChoice( 4, Networking.IsHost ) } );
GameManager.Instance.TriggerChoicePopup( multiplayerVaultEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career loops
GameManager.AddLog( "\n=== WEAPON VAULT EVENT ===" );
GameManager.AddLog( "A floating vault opens, revealing 4 weapons." );
GameManager.AddLog( "⚠️ AWAITING HARDWARE DATA OVERCLOCK LINK..." );
int secretAIChoice = Random.Shared.Next( 1, 5 );
void FinalizeVaultExtractions( int playerChoice )
{
GiveWeapon( "Player", playerChoice, p );
GiveWeapon( "AI", secretAIChoice, a );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
var vaultEvent = new ChoiceEvent
{
Title = "🛡️ CRYPTO WEAPON VAULT OVERRIDE",
PromptText = "A floating digital armor vault has materialized in the core matrix workspace. Four distinct security firmware modifications are online. Select your download slice:",
};
vaultEvent.Options.Add( new EventOption { ButtonText = $"🔥 EQUIP FLAME BLADE (+{15 + scaledAttackBonus} ATK)", ActionToExecute = () => FinalizeVaultExtractions( 1 ) } );
vaultEvent.Options.Add( new EventOption { ButtonText = $"❄️ EQUIP FROST HAMMER (+{10 + scaledAttackBonus} ATK, +{5 + scaledDefBonus} DEF)", ActionToExecute = () => FinalizeVaultExtractions( 2 ) } );
vaultEvent.Options.Add( new EventOption { ButtonText = $"⚡ EQUIP VOLT DAGGER (+{20 + scaledAttackBonus} ATK, 50% -{scaledRecoilDmg} HP RECOIL)", ActionToExecute = () => FinalizeVaultExtractions( 3 ) } );
vaultEvent.Options.Add( new EventOption { ButtonText = $"🪨 EQUIP STONE SHIELD (+{25 + scaledDefBonus} DEF)", ActionToExecute = () => FinalizeVaultExtractions( 4 ) } );
GameManager.Instance.TriggerChoicePopup( vaultEvent );
}
break;
}
case 51:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Calculate scaled prestige modifications (Flattened to baseline for competitive multiplayer matches)
int scaledRedHeal = 30 + ((isMultiplayer ? 0 : prestige) * 5);
int scaledRedSuperHeal = 50 + ((isMultiplayer ? 0 : prestige) * 8);
int scaledBlueBuff = 10 + ((isMultiplayer ? 0 : prestige) * 2);
int scaledBlueExtra = 15 + ((isMultiplayer ? 0 : prestige) * 3);
int scaledGreenPoison = 30 + ((isMultiplayer ? 0 : prestige) * 5);
int scaledGreenStrength = 30 + ((isMultiplayer ? 0 : prestige) * 4);
int scaledPurpleAscendHp = 40 + ((isMultiplayer ? 0 : prestige) * 6);
int scaledPurpleAscendAtk = 20 + ((isMultiplayer ? 0 : prestige) * 3);
int scaledPurpleExplode = 50 + ((isMultiplayer ? 0 : prestige) * 8);
int scaledPurpleUntouchable = 50 + ((isMultiplayer ? 0 : prestige) * 6);
var p = player;
var a = ai;
string[] potionNames = { "", "Red Potion", "Blue Potion", "Green Potion", "Purple Potion" };
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE REGISTERS
// =========================================================================
int p1PotionChoice = 0;
int p2PotionChoice = 0;
bool isAlchemyResolved = false;
void DrinkPotion( string name, int potion, Player target, int targetMaxHp )
{
int luck = Random.Shared.Next( 0, 100 ); // 0 to 99 inclusive
switch ( potion )
{
case 1:
GameManager.AddLog( $"🧪 {name} drinks the **Red Potion**" );
int totalRedHeal = scaledRedHeal + target.eventHealingBuff;
target.hp += totalRedHeal;
if ( luck < 20 )
{
int totalSuperHeal = scaledRedSuperHeal + target.eventHealingBuff;
GameManager.AddLog( $"🔥 It was super-charged! +{totalSuperHeal} HP EXTRA!" );
target.hp += totalSuperHeal;
}
target.eventHealingBuff = 0;
break;
case 2:
GameManager.AddLog( $"🧪 {name} drinks the **Blue Potion**" );
target.eventAttackBuff += scaledBlueBuff;
target.eventAttackBuff += scaledBlueBuff;
if ( luck < 35 )
{
GameManager.AddLog( $"✨ {name}, the mystics granted you an extra +{scaledBlueExtra} on attack and defense!" );
target.eventAttackBuff += scaledBlueExtra;
target.eventAttackBuff += scaledBlueExtra;
}
break;
case 3:
GameManager.AddLog( $"🧪 {name} drinks the **Green Potion**" );
if ( luck < 50 )
{
GameManager.AddLog( $"💥 {name} is poisoned! -{scaledGreenPoison} HP!" );
target.hp -= scaledGreenPoison;
}
else
{
GameManager.AddLog( $"⚡ {name} gains hazmat strength! +{scaledGreenStrength} attack!" );
target.eventAttackBuff += scaledGreenStrength;
}
break;
case 4:
GameManager.AddLog( $"🧪 {name} drinks the **Purple Potion**" );
if ( luck < 33 )
{
int totalPurpleHeal = scaledPurpleAscendHp + target.eventHealingBuff;
GameManager.AddLog( $"🌌 {name} ascends briefly! +{totalPurpleHeal} HP & +{scaledPurpleAscendAtk} attack!" );
target.hp += totalPurpleHeal;
target.eventAttackBuff += scaledPurpleAscendAtk;
target.eventHealingBuff = 0;
}
else if ( luck < 66 )
{
GameManager.AddLog( $"💥 The potion explodes! -{scaledPurpleExplode} HP!" );
target.hp -= scaledPurpleExplode;
}
else
{
GameManager.AddLog( $"🛡️ {name} becomes UNTOUCHABLE! +{scaledPurpleUntouchable} defense!" );
target.eventAttackBuff += scaledPurpleUntouchable;
}
break;
}
if ( target.hp > targetMaxHp ) target.hp = targetMaxHp;
if ( target.hp < 0 ) target.hp = 0;
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== ALCHEMY TABLE EVENT ===" );
GameManager.AddLog( "Four mysterious potions bubble on a wooden table... Both terminals must choose an elixir!" );
GameManager.AddLog( "⚠️ AWAITING CHEMICAL EXTRACTION CONTEXT..." );
var multiplayerAlchemyEvent = new ChoiceEvent
{
Title = "🧪 CYBER ALCHEMY PROTOCOL",
PromptText = "Four highly unstable chemical mixtures are bubbling on the terminal workstation logic board. Select your download elixir:",
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1PotionChoice = choiceIndex;
else p2PotionChoice = choiceIndex;
if ( p1PotionChoice > 0 && p2PotionChoice > 0 && !isAlchemyResolved )
{
isAlchemyResolved = true;
GameManager.AddLog( $"\n🧪 [ALCHEMY DUAL CONSUMPTION OUTCOME] Chemical vectors synchronized!" );
DrinkPotion( p.name, p1PotionChoice, p, maxPlayerHp );
DrinkPotion( a.name, p2PotionChoice, a, maxAIHp );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their alchemy mixture selection packet!" );
}
};
multiplayerAlchemyEvent.Options.Add( new EventOption { ButtonText = "🔴 DRINK RED POTION (HUGE HEAL)", ActionToExecute = () => handleNetworkChoice( 1, Networking.IsHost ) } );
multiplayerAlchemyEvent.Options.Add( new EventOption { ButtonText = "🔵 DRINK BLUE POTION (MYSTIC BUFF)", ActionToExecute = () => handleNetworkChoice( 2, Networking.IsHost ) } );
multiplayerAlchemyEvent.Options.Add( new EventOption { ButtonText = "🟢 DRINK GREEN POTION (TOXIC GAMBLE)", ActionToExecute = () => handleNetworkChoice( 3, Networking.IsHost ) } );
multiplayerAlchemyEvent.Options.Add( new EventOption { ButtonText = "🟣 DRINK PURPLE POTION (CHAOS EFFECT)", ActionToExecute = () => handleNetworkChoice( 4, Networking.IsHost ) } );
GameManager.Instance.TriggerChoicePopup( multiplayerAlchemyEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career rules
GameManager.AddLog( "\n=== ALCHEMY TABLE EVENT ===" );
GameManager.AddLog( "Four mysterious potions bubble on a wooden table..." );
GameManager.AddLog( "⚠️ AWAITING CHEMICAL EXTRACTION CONTEXT..." );
int secretAIChoice = Random.Shared.Next( 1, 5 );
void SettleAlchemyConsumption( int playerChoice )
{
DrinkPotion( "Player", playerChoice, p, maxPlayerHp );
DrinkPotion( "AI", secretAIChoice, a, maxAIHp );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
var alchemyEvent = new ChoiceEvent
{
Title = "🧪 CYBER ALCHEMY PROTOCOL",
PromptText = "Four highly unstable chemical mixtures are bubbling on the terminal workstation logic board. Each holding intense kernel modifications balanced with catastrophic side-effect variables. Select your download elixir:",
};
alchemyEvent.Options.Add( new EventOption { ButtonText = "🔴 DRINK RED POTION (HUGE HEAL)", ActionToExecute = () => SettleAlchemyConsumption( 1 ) } );
alchemyEvent.Options.Add( new EventOption { ButtonText = "🔵 DRINK BLUE POTION (MYSTIC BUFF)", ActionToExecute = () => SettleAlchemyConsumption( 2 ) } );
alchemyEvent.Options.Add( new EventOption { ButtonText = "🟢 DRINK GREEN POTION (TOXIC GAMBLE)", ActionToExecute = () => SettleAlchemyConsumption( 3 ) } );
alchemyEvent.Options.Add( new EventOption { ButtonText = "🟣 DRINK PURPLE POTION (CHAOS EFFECT)", ActionToExecute = () => SettleAlchemyConsumption( 4 ) } );
GameManager.Instance.TriggerChoicePopup( alchemyEvent );
}
break;
}
case 52:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Calculate prestige scaling modifiers for die mechanics (Flattened to baseline for competitive multiplayer)
int prestigeHealBonus = isMultiplayer ? 0 : prestige * 2;
int prestigeDamageBonus = isMultiplayer ? 0 : prestige * 2;
int prestigeAtkBonus = isMultiplayer ? 0 : prestige * 1;
int scaledDeathDrain = isMultiplayer ? 15 : 15 + (prestige * 2);
var p = player;
var a = ai;
string[] dieNames = { "", "Die of Life", "Die of Pain", "Die of Chaos", "Die of Death" };
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE PROTOCOLS
// =========================================================================
int p1DiceChoice = 0;
int p2DiceChoice = 0;
bool isDeathDiceResolved = false;
void RollDeathDie( string name, int pick, Player target, int targetMaxHp )
{
int roll = Random.Shared.Next( 1, 5 );
GameManager.AddLog( $"🎲 {name} rolls the **{dieNames[pick]}** and scores a: **{roll}**!" );
switch ( pick )
{
case 1: // Life
int finalHeal = (roll * 10) + prestigeHealBonus + target.eventHealingBuff;
target.hp += finalHeal;
GameManager.AddLog( $"💚 {name} gains +{finalHeal} HP!" );
target.eventHealingBuff = 0;
break;
case 2: // Pain
int finalPain = (roll * 10) + prestigeDamageBonus;
target.hp -= finalPain;
GameManager.AddLog( $"💥 {name} loses -{finalPain} HP!" );
break;
case 3: // Chaos
if ( roll % 2 == 0 )
{
int finalBuff = (roll * 5) + prestigeAtkBonus;
target.eventAttackBuff += finalBuff;
GameManager.AddLog( $"⚡ {name} gains +{finalBuff} attack next turn!" );
}
else
{
int finalDmg = (roll * 10) + prestigeDamageBonus;
target.hp -= finalDmg;
GameManager.AddLog( $"💥 {name} takes -{finalDmg} damage!" );
}
break;
case 4: // Death
if ( roll == 4 )
{
GameManager.AddLog( $"💀 {name} is INSTANTLY DESTROYED!" );
target.hp = 0;
}
else
{
GameManager.AddLog( $"🛡️ {name} survives... but is drained." );
target.hp -= scaledDeathDrain;
}
break;
}
if ( target.hp > targetMaxHp ) target.hp = targetMaxHp;
if ( target.hp < 0 ) target.hp = 0;
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== DEATH DICE EVENT ===" );
GameManager.AddLog( "A skeletal hand offers two dice... Both players must lock their mortal selection parameters!" );
GameManager.AddLog( "⚠️ AWAITING MORTAL SELECTION PARAMETERS..." );
var multiplayerDiceEvent = new ChoiceEvent
{
Title = "💀 THE DEATH DICE INTRUSION",
PromptText = "A glitching skeletal framework has hard-locked the execution block. Select your hazard logic die gamble:",
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1DiceChoice = choiceIndex;
else p2DiceChoice = choiceIndex;
if ( p1DiceChoice > 0 && p2DiceChoice > 0 && !isDeathDiceResolved )
{
isDeathDiceResolved = true;
GameManager.AddLog( $"\n💀 [DEATH DICE DUEL OUTCOME] Symmetrical mortal parameters synchronized!" );
RollDeathDie( p.name, p1DiceChoice, p, maxPlayerHp );
RollDeathDie( a.name, p2DiceChoice, a, maxAIHp );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their mortal dice selection packet!" );
}
};
multiplayerDiceEvent.Options.Add( new EventOption { ButtonText = "💚 ROLL DIE OF LIFE (SAFE HEAL)", ActionToExecute = () => handleNetworkChoice( 1, Networking.IsHost ) } );
multiplayerDiceEvent.Options.Add( new EventOption { ButtonText = "💔 ROLL DIE OF PAIN (DAMAGE RISK)", ActionToExecute = () => handleNetworkChoice( 2, Networking.IsHost ) } );
multiplayerDiceEvent.Options.Add( new EventOption { ButtonText = "⚡ ROLL DIE OF CHAOS (BUFF / DEBUFF)", ActionToExecute = () => handleNetworkChoice( 3, Networking.IsHost ) } );
multiplayerDiceEvent.Options.Add( new EventOption { ButtonText = "💀 ROLL DIE OF DEATH (25% CHANCE AT INSTANT LOSS)", ActionToExecute = () => handleNetworkChoice( 4, Networking.IsHost ) } );
GameManager.Instance.TriggerChoicePopup( multiplayerDiceEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career rules
GameManager.AddLog( "\n=== DEATH DICE EVENT ===" );
GameManager.AddLog( "A skeletal hand offers two dice..." );
GameManager.AddLog( "⚠️ AWAITING MORTAL SELECTION PARAMETERS..." );
int secretAIChoice = Random.Shared.Next( 1, 5 );
void SettleMortalGamble( int playerChoice )
{
RollDeathDie( "Player", playerChoice, p, maxPlayerHp );
RollDeathDie( "AI", secretAIChoice, a, maxAIHp );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
var deathDiceEvent = new ChoiceEvent
{
Title = "💀 THE DEATH DICE INTRUSION",
PromptText = "A glitching skeletal framework has hard-locked the execution block. Four hazardous logic dice have populated on the monitor. Will you heal securely or gamble your entire execution thread?",
};
deathDiceEvent.Options.Add( new EventOption { ButtonText = "💚 ROLL DIE OF LIFE (SAFE HEAL)", ActionToExecute = () => SettleMortalGamble( 1 ) } );
deathDiceEvent.Options.Add( new EventOption { ButtonText = "💔 ROLL DIE OF PAIN (DAMAGE RISK)", ActionToExecute = () => SettleMortalGamble( 2 ) } );
deathDiceEvent.Options.Add( new EventOption { ButtonText = "⚡ ROLL DIE OF CHAOS (BUFF / DEBUFF)", ActionToExecute = () => SettleMortalGamble( 3 ) } );
deathDiceEvent.Options.Add( new EventOption { ButtonText = "💀 ROLL DIE OF DEATH (25% CHANCE AT INSTANT LOSS)", ActionToExecute = () => SettleMortalGamble( 4 ) } );
GameManager.Instance.TriggerChoicePopup( deathDiceEvent );
}
break;
}
case 53:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Calculate scaled prestige modifications (Flattened to baseline for competitive multiplayer matches)
int scaledContractAtk = 20 + ((isMultiplayer ? 0 : prestige) * 3);
int scaledContractDef = 10 + ((isMultiplayer ? 0 : prestige) * 2);
int scaledContractHeal = 30 + ((isMultiplayer ? 0 : prestige) * 5);
int scaledCowardPunish = 15 + ((isMultiplayer ? 0 : prestige) * 3);
int scaledEnragedExplosion = 10 + ((isMultiplayer ? 0 : prestige) * 2);
var p = player;
var a = ai;
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE REGISTERS
// =========================================================================
int p1ContractChoice = 0;
int p2ContractChoice = 0;
bool isContractResolved = false;
void ResolveDemonicContract( int choicePlayer, int choiceAI )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"📜 {p.name} chooses to {(choicePlayer == 1 ? "sign" : "refuse")}." );
GameManager.AddLog( $"📜 {a.name} chooses to {(choiceAI == 1 ? "sign" : "refuse")}!\n" );
}
else
{
GameManager.AddLog( $"You choose to {(choicePlayer == 1 ? "sign" : "refuse")}." );
GameManager.AddLog( $"AI chooses to {(choiceAI == 1 ? "sign" : "refuse")}!\n" );
}
// CASE: BOTH SIGN.
if ( choicePlayer == 1 && choiceAI == 1 )
{
int finalPlayerHeal = scaledContractHeal + p.eventHealingBuff;
int finalAIHeal = scaledContractHeal + a.eventHealingBuff;
GameManager.AddLog( "** BOTH sign the demonic pact! **" );
if ( isMultiplayer ) GameManager.AddLog( $"An infernal rush of power surges through both bodies! ({p.name}: +{scaledContractAtk} ATK, +{scaledContractDef} DEF, +{finalPlayerHeal} HP | {a.name}: +{scaledContractAtk} ATK, +{scaledContractDef} DEF, +{finalAIHeal} HP)" );
else GameManager.AddLog( $"An infernal rush of power surges through your bodies! (You: +{scaledContractAtk} ATK next turn, +{scaledContractDef} DEF next turn, +{finalPlayerHeal} HP | AI: +{scaledContractAtk} ATK next turn, +{scaledContractDef} DEF next turn, +{finalAIHeal} HP)" );
p.eventAttackBuff += scaledContractAtk;
p.eventAttackBuff += scaledContractDef;
p.hp += finalPlayerHeal;
a.eventAttackBuff += scaledContractAtk;
a.eventAttackBuff += scaledContractDef;
a.hp += finalAIHeal;
p.cursed = true;
a.cursed = true;
if ( Random.Shared.Next( 1, 101 ) < 2 )
{
if ( isMultiplayer ) GameManager.AddLog( $"\n** BUT THE DEMON CLAIMS A SOUL! {p.name} DIES INSTANTLY! **" );
else GameManager.AddLog( "\n** BUT THE DEMON CLAIMS A SOUL! YOU DIE INSTANTLY! **" );
p.hp = 0;
}
if ( Random.Shared.Next( 1, 101 ) < 2 )
{
if ( isMultiplayer ) GameManager.AddLog( $"\n** THE DEMON CLAIMS {a.name.ToUpper()}'S SOUL! **" );
else GameManager.AddLog( "\n** THE DEMON CLAIMS THE AI'S SOUL! **" );
a.hp = 0;
}
if ( p.hp > maxPlayerHp ) p.hp = maxPlayerHp;
if ( a.hp > maxAIHp ) a.hp = maxAIHp;
p.eventHealingBuff = 0;
a.eventHealingBuff = 0;
return;
}
// CASE: PLAYER 1 SIGNS, PLAYER 2 REFUSES.
if ( choicePlayer == 1 && choiceAI == 2 )
{
int finalPlayerHeal = scaledContractHeal + p.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"** {p.name} signs, {a.name} refuses! **" );
else GameManager.AddLog( "** You sign, AI refuses! **" );
GameManager.AddLog( $"The demon favors BOLDNESS. (+{scaledContractAtk} ATK next turn, +{scaledContractDef} DEF next turn, +{finalPlayerHeal} HP)" );
p.eventAttackBuff += scaledContractAtk;
p.eventAttackBuff += scaledContractDef;
p.hp += finalPlayerHeal;
p.cursed = true;
if ( Random.Shared.Next( 1, 101 ) < 6 )
{
GameManager.AddLog( $"** The demon punishes {a.name} for cowardice! -{scaledCowardPunish} HP **" );
CombatManager.applyDamage( ref a, scaledCowardPunish );
}
if ( p.hp > maxPlayerHp ) p.hp = maxPlayerHp;
if ( a.hp < 0 ) a.hp = 0;
p.eventHealingBuff = 0;
return;
}
// CASE: PLAYER 1 REFUSES, PLAYER 2 SIGNS.
if ( choicePlayer == 2 && choiceAI == 1 )
{
int finalAIHeal = scaledContractHeal + a.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"** {a.name} signs, {p.name} refuses! **" );
else GameManager.AddLog( "** AI signs, YOU refuse! **" );
GameManager.AddLog( $"The demon rewards {a.name} instead. (+{scaledContractAtk} ATK next turn, +{scaledContractDef} DEF next turn, +{finalAIHeal} HP)" );
a.eventAttackBuff += scaledContractAtk;
a.eventAttackBuff += scaledContractDef;
a.hp += finalAIHeal;
a.cursed = true;
if ( Random.Shared.Next( 1, 101 ) < 6 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** The demon punishes {p.name}'s cowardice! -{scaledCowardPunish} HP **" );
else GameManager.AddLog( $"** The demon punishes YOUR cowardice! -{scaledCowardPunish} HP **" );
CombatManager.applyDamage( ref p, scaledCowardPunish );
}
if ( a.hp > maxAIHp ) a.hp = maxAIHp;
if ( p.hp < 0 ) p.hp = 0;
a.eventHealingBuff = 0;
return;
}
// CASE: BOTH REFUSE.
GameManager.AddLog( "** Both refuse! The demon is ENRAGED! **" );
GameManager.AddLog( $"It EXPLODES in fury - both take -{scaledEnragedExplosion} HP!" );
CombatManager.applyDamage( ref p, scaledEnragedExplosion );
CombatManager.applyDamage( ref a, scaledEnragedExplosion );
if ( p.hp < 0 ) p.hp = 0;
if ( a.hp < 0 ) a.hp = 0;
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== DEMON CONTRACT EVENT ===" );
GameManager.AddLog( "A blazing red sigil appears beneath you both." );
GameManager.AddLog( "\"SIGN THE CONTRACT AND GAIN POWER.. OR REFUSE AND BE WEAK!\" the demon roars.\n" );
GameManager.AddLog( "⚠️ AWAITING INFERNAL ACCOUNT SIGNATURES..." );
var multiplayerContractEvent = new ChoiceEvent
{
Title = "🔥 DEMONIC PARTITION PACK CONTRACT",
PromptText = "An unholy crimson sigil has engulfed your local core files. Will you execute signature?",
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1ContractChoice = choiceIndex;
else p2ContractChoice = choiceIndex;
if ( p1ContractChoice > 0 && p2ContractChoice > 0 && !isContractResolved )
{
isContractResolved = true;
GameManager.AddLog( $"\n🔥 [NET CONTRACT RESOLUTION] Symmetrical infernal pact data locked!" );
ResolveDemonicContract( p1ContractChoice, p2ContractChoice );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their demonic contract signature choice vector!" );
}
};
multiplayerContractEvent.Options.Add( new EventOption { ButtonText = "🖋️ SIGN THE CONTRACT (GAIN POWER & CURSE)", ActionToExecute = () => handleNetworkChoice( 1, Networking.IsHost ) } );
multiplayerContractEvent.Options.Add( new EventOption { ButtonText = "🛡️ REFUSE SIGNATURE (RISK WRATH)", ActionToExecute = () => handleNetworkChoice( 2, Networking.IsHost ) } );
GameManager.Instance.TriggerChoicePopup( multiplayerContractEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career rules
GameManager.AddLog( "\n=== DEMON CONTRACT EVENT ===" );
GameManager.AddLog( "A blazing red sigil appears beneath you both." );
GameManager.AddLog( "\"SIGN THE CONTRACT AND GAIN POWER.. OR REFUSE AND BE WEAK!\" the demon roars.\n" );
GameManager.AddLog( "⚠️ AWAITING INFERNAL ACCOUNT SIGNATURE..." );
int secretAIChoice = Random.Shared.Next( 1, 3 );
var contractEvent = new ChoiceEvent
{
Title = "🔥 DEMONIC PARTITION PACK CONTRACT",
PromptText = "An unholy crimson sigil has engulfed your local core files. A demonic intelligence demands a security contract exchange for monumental damage values balanced against a permanent tick-curse loop. Will you execute signature?",
};
contractEvent.Options.Add( new EventOption
{
ButtonText = "🖋️ SIGN THE CONTRACT (GAIN POWER & CURSE)",
ActionToExecute = () => { ResolveDemonicContract( 1, secretAIChoice ); }
} );
contractEvent.Options.Add( new EventOption
{
ButtonText = "🛡️ REFUSE SIGNATURE (RISK WRATH)",
ActionToExecute = () => { ResolveDemonicContract( 2, secretAIChoice ); }
} );
GameManager.Instance.TriggerChoicePopup( contractEvent );
}
break;
}
case 54:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Calculate prestige-scaled rewards and damage lineally (Flattened to baseline for multiplayer matches)
int scaleJackpotHeal = isMultiplayer ? 50 : 50 + (prestige * 8);
int scaleJackpotBuff = isMultiplayer ? 30 : 30 + (prestige * 5);
int scaleTripleSword = isMultiplayer ? 20 : 20 + (prestige * 3);
int scaleTripleShield = isMultiplayer ? 20 : 20 + (prestige * 3);
int scaleTripleBomb = isMultiplayer ? 40 : 40 + (prestige * 6);
int scaleDoubleSkull = isMultiplayer ? 25 : 25 + (prestige * 4);
int scaleTripleHeart = isMultiplayer ? 30 : 30 + (prestige * 5);
int scaleDoubleHeart = isMultiplayer ? 15 : 15 + (prestige * 2);
int scaleDoubleSword = isMultiplayer ? 10 : 10 + (prestige * 2);
int scaleDoubleShield = isMultiplayer ? 10 : 10 + (prestige * 2);
int scaleMinorDamage = isMultiplayer ? 15 : 15 + (prestige * 2);
int scaleMinorHeal = isMultiplayer ? 5 : 5 + (prestige * 1);
List<string> names = new List<string>
{
"SKULL", "HEART", "SWORD", "SHIELD", "CHAOS", "COIN", "BOMB"
};
int[] pSpin = new int[3];
int[] aSpin = new int[3];
pSpin[0] = Random.Shared.Next( names.Count );
pSpin[1] = Random.Shared.Next( names.Count );
pSpin[2] = Random.Shared.Next( names.Count );
aSpin[0] = Random.Shared.Next( names.Count );
aSpin[1] = Random.Shared.Next( names.Count );
aSpin[2] = Random.Shared.Next( names.Count );
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== RANDOM EVENT ===" );
GameManager.AddLog( "** SLOT MACHINE OF DOOM appears with three glowing reels! **" );
GameManager.AddLog( $"Both {player.name} and {ai.name} pull the lever and hope for fortune... or DOOM!" );
GameManager.AddLog( $"{player.name} reels: [{names[pSpin[0]]}] [{names[pSpin[1]]}] [{names[pSpin[2]]}]" );
GameManager.AddLog( $"{ai.name} reels: [{names[aSpin[0]]}] [{names[aSpin[1]]}] [{names[aSpin[2]]}]" );
}
else
{
GameManager.AddLog( "\n=== RANDOM EVENT ===" );
GameManager.AddLog( "** SLOT MACHINE OF DOOM appears with three glowing reels! **" );
GameManager.AddLog( "Both you and the AI pull the lever and hope for fortune... or DOOM!" );
GameManager.AddLog( $"You reels: [{names[pSpin[0]]}] [{names[pSpin[1]]}] [{names[pSpin[2]]}]" );
GameManager.AddLog( $"AI reels: [{names[aSpin[0]]}] [{names[aSpin[1]]}] [{names[aSpin[2]]}]" );
}
GameManager.AddLog( "" );
int CountSym( int[] spin, int sym )
{
int c = 0;
for ( int i = 0; i < 3; i++ )
{
if ( spin[i] == sym ) c++;
}
return c;
}
// Player 1 Outcome.
int pSkull = CountSym( pSpin, 0 );
int pHeart = CountSym( pSpin, 1 );
int pSword = CountSym( pSpin, 2 );
int pShield = CountSym( pSpin, 3 );
int pChaos = CountSym( pSpin, 4 );
int pCoin = CountSym( pSpin, 5 );
int pBomb = CountSym( pSpin, 6 );
if ( isMultiplayer ) GameManager.AddLog( $"-- Resolving {player.name}'s spin --" );
else GameManager.AddLog( "-- Resolving your spin --" );
if ( pSkull == 3 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** HORRIFYING! Three SKULLS! {player.name} is instantly destroyed by the machine! **" );
else GameManager.AddLog( "** HORRIFYING! Three SKULLS! You are instantly destroyed by the machine! **" );
player.hp = 0;
}
else if ( pCoin == 3 )
{
int totalJackpotHeal = scaleJackpotHeal + player.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"** JACKPOT OF DOOM! Three COINS! {player.name} is showered in gold and power! **" );
else GameManager.AddLog( "** JACKPOT OF DOOM! Three COINS! You are showered in gold and power! **" );
player.hp += totalJackpotHeal;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
player.eventAttackBuff += scaleJackpotBuff;
player.eventHealingBuff = 0;
if ( isMultiplayer ) GameManager.AddLog( $"{player.name} gains +{totalJackpotHeal} HP and +{scaleJackpotBuff} attack!" );
else GameManager.AddLog( $"You gain +{totalJackpotHeal} HP and +{scaleJackpotBuff} attack!" );
}
else if ( pSword == 3 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** Three SWORDS! {player.name}'s weapons beam with energy! **" );
else GameManager.AddLog( "** Three SWORDS! Your weapons beam with energy! **" );
player.eventAttackBuff += scaleTripleSword;
if ( isMultiplayer ) GameManager.AddLog( $"{player.name} gains +{scaleTripleSword} attack buff!" );
else GameManager.AddLog( $"You gain +{scaleTripleSword} attack buff!" );
}
else if ( pShield == 3 )
{
int totalShieldHeal = scaleTripleShield + player.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"** Three SHIELDS! The machine grants {player.name} protection! **" );
else GameManager.AddLog( "** Three SHIELDS! The machine grants you protection! **" );
player.hp += totalShieldHeal;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
player.eventAttackBuff += 5;
player.eventHealingBuff = 0;
if ( isMultiplayer ) GameManager.AddLog( $"{player.name} heals +{totalShieldHeal} HP and gains a small defensive buff (+5 attack)." );
else GameManager.AddLog( $"You heal +{totalShieldHeal} HP and gain a small defensive buff (+5 attack)." );
}
else if ( pBomb == 3 )
{
GameManager.AddLog( "** BOOM! Three BOMBS - the machine EXPLODES! Both fighters take critical damage! **" );
CombatManager.applyDamage( ref player, scaleTripleBomb );
CombatManager.applyDamage( ref ai, scaleTripleBomb );
GameManager.AddLog( $"Both take {scaleTripleBomb} damage!" );
}
else if ( pChaos >= 1 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** CHAOS symbol! A random chaotic effect triggers on {player.name}... **" );
else GameManager.AddLog( "** CHAOS symbol! A random chaotic effect triggers on you... **" );
int r = Random.Shared.Next( 6 );
if ( r == 0 )
{
if ( isMultiplayer ) GameManager.AddLog( $"Chaos swaps {player.name}'s HP with {ai.name}'s HP!" );
else GameManager.AddLog( "Chaos swaps your HP with the AI's HP!" );
int temp = player.hp;
player.hp = ai.hp;
ai.hp = temp;
}
else if ( r == 1 )
{
if ( isMultiplayer ) GameManager.AddLog( $"Chaos swaps {player.name}'s base attack with {ai.name}'s base attack!" );
else GameManager.AddLog( "Chaos swaps your base attack with the AI's base attack!" );
int temp = player.attack;
player.attack = ai.attack;
ai.attack = temp;
}
else if ( r == 2 )
{
GameManager.AddLog( "Chaos swaps attack buffs!" );
int temp = player.eventAttackBuff;
player.eventAttackBuff = ai.eventAttackBuff;
ai.eventAttackBuff = temp;
}
else if ( r == 3 )
{
if ( isMultiplayer ) GameManager.AddLog( $"Chaos fully heals {player.name}!" );
else GameManager.AddLog( "Chaos fully heals you!" );
player.hp = maxPlayerHp;
}
else if ( r == 4 )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"Chaos STUNS {ai.name}!" );
if ( manager != null ) manager.IsPlayerTwoDazed = true;
}
else
{
GameManager.AddLog( "Chaos STUNS the AI!" );
aiBuff = -999;
}
}
else
{
GameManager.AddLog( $"The machine sputters and explodes! Both take -{scaleMinorDamage} HP!" );
CombatManager.applyDamage( ref player, scaleMinorDamage );
CombatManager.applyDamage( ref ai, scaleMinorDamage );
}
}
else if ( pSkull == 2 )
{
if ( isMultiplayer ) GameManager.AddLog( $"Two SKULLS - {player.name} takes heavy damage! -{scaleDoubleSkull} HP" );
else GameManager.AddLog( $"Two SKULLS - You take heavy damage! -{scaleDoubleSkull} HP" );
CombatManager.applyDamage( ref player, scaleDoubleSkull );
}
else if ( pHeart == 3 )
{
int totalHeartHeal = scaleTripleHeart + player.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"Three HEARTS - the machine blesses {player.name} with potent healing! +{totalHeartHeal} HP" );
else GameManager.AddLog( $"Three HEARTS - the machine blesses you with potent healing! +{totalHeartHeal} HP" );
player.hp += totalHeartHeal;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
player.eventHealingBuff = 0;
}
else if ( pHeart == 2 )
{
int totalHeartHeal = scaleDoubleHeart + player.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"Two HEARTS - small healing granted. +{totalHeartHeal} HP" );
else GameManager.AddLog( $"Two HEARTS - small healing granted. +{totalHeartHeal} HP" );
player.hp += totalHeartHeal;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
player.eventHealingBuff = 0;
}
else if ( pSword == 2 )
{
if ( isMultiplayer ) GameManager.AddLog( $"Two SWORDS - modest weapon boost to {player.name}. +{scaleDoubleSword} attack" );
else GameManager.AddLog( $"Two SWORDS - modest weapon boost. +{scaleDoubleSword} attack" );
player.eventAttackBuff += scaleDoubleSword;
}
else if ( pShield == 2 )
{
int totalShieldHeal = scaleDoubleShield + player.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"Two SHIELDS - small defensive aid and heal to {player.name}. +{totalShieldHeal} HP" );
else GameManager.AddLog( $"Two SHIELDS - small defensive aid and heal. +{totalShieldHeal} HP" );
player.hp += totalShieldHeal;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
player.eventAttackBuff += 5;
player.eventHealingBuff = 0;
}
else if ( pBomb >= 1 )
{
if ( Random.Shared.Next( 100 ) < 50 )
{
if ( isMultiplayer ) GameManager.AddLog( $"A stray bomb fragment hits {player.name}! -{scaleMinorDamage} HP" );
else GameManager.AddLog( $"A stray bomb fragment hits you! -{scaleMinorDamage} HP" );
CombatManager.applyDamage( ref player, scaleMinorDamage );
}
else
{
GameManager.AddLog( "Bomb fizzles but does not explode!" );
}
}
else
{
if ( Random.Shared.Next( 100 ) < 50 )
{
int totalMinorHeal = scaleMinorHeal + player.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"The machine coughs and gives {player.name} a tiny coin +{totalMinorHeal} HP" );
else GameManager.AddLog( $"The machine coughs and gives you a tiny coin +{totalMinorHeal} HP" );
player.hp += totalMinorHeal;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
player.eventHealingBuff = 0;
}
else
{
GameManager.AddLog( "Nothing much - the reels reset." );
}
}
// Player 2 / AI outcome.
int aSkull = CountSym( aSpin, 0 );
int aHeart = CountSym( aSpin, 1 );
int aSword = CountSym( aSpin, 2 );
int aShield = CountSym( aSpin, 3 );
int aChaos = CountSym( aSpin, 4 );
int aCoin = CountSym( aSpin, 5 );
int aBomb = CountSym( aSpin, 6 );
if ( isMultiplayer ) GameManager.AddLog( $"\n-- Resolving {ai.name}'s spin --" );
else GameManager.AddLog( "\n-- Resolving AI spin --" );
if ( aSkull == 3 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** HORRIFYING! {ai.name} rolled three SKULLS and is instantly destroyed by the machine! **" );
else GameManager.AddLog( "** HORRIFYING! AI rolled three SKULLS and is instantly destroyed by the machine! **" );
ai.hp = 0;
}
else if ( aCoin == 3 )
{
int totalJackpotHealAI = scaleJackpotHeal + ai.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"** {ai.name} hits a JACKPOT (three COINS!) {ai.name} gained massive rewards! **" );
else GameManager.AddLog( $"** AI hits a JACKPOT (three COINS!) AI gained massive rewards! **" );
ai.hp += totalJackpotHealAI;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
ai.eventAttackBuff += scaleJackpotBuff;
ai.eventHealingBuff = 0;
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name} +{totalJackpotHealAI} HP and +{scaleJackpotBuff} attack buff!" );
else GameManager.AddLog( $"AI +{totalJackpotHealAI} HP and +{scaleJackpotBuff} attack buff!" );
}
else if ( aSword == 3 )
{
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name} reeled three SWORDS - their weapons power up! +{scaleTripleSword} attack" );
else GameManager.AddLog( $"AI reeled three SWORDS - its weapons power up! +{scaleTripleSword} attack" );
ai.eventAttackBuff += scaleTripleSword;
}
else if ( aShield == 3 )
{
int totalShieldHealAI = scaleTripleShield + ai.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name} reeled three SHIELDS - firewalling their defenses! +{scaleTripleShield} HP" );
else GameManager.AddLog( $"AI reeled three SHIELDS - firewalling its defenses! +{scaleTripleShield} HP" );
ai.hp += totalShieldHealAI;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
ai.eventAttackBuff += 5;
ai.eventHealingBuff = 0;
}
else if ( aBomb == 3 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** BOOM! {ai.name}'s machine explodes - both take heavy damage! **" );
else GameManager.AddLog( $"** BOOM! AI's machine explodes - both take heavy damage! **" );
CombatManager.applyDamage( ref player, scaleTripleBomb );
CombatManager.applyDamage( ref ai, scaleTripleBomb );
GameManager.AddLog( $"Both take {scaleTripleBomb} damage!" );
}
else if ( aChaos >= 1 )
{
if ( isMultiplayer ) GameManager.AddLog( $"** {ai.name} triggered CHAOS! A random chaotic event affects the battlefield! **" );
else GameManager.AddLog( "AI triggered CHAOS! A random chaotic event affects the battlefield!" );
int r = Random.Shared.Next( 6 );
if ( r == 0 )
{
if ( isMultiplayer ) GameManager.AddLog( $"Chaos swaps {ai.name}'s HP with {player.name}'s HP!" );
else GameManager.AddLog( "Chaos swaps AI HP with yours!" );
int temp = player.hp;
player.hp = ai.hp;
ai.hp = temp;
}
else if ( r == 1 )
{
GameManager.AddLog( "Chaos swaps base attacks!" );
int temp = player.attack;
player.attack = ai.attack;
ai.attack = temp;
}
else if ( r == 2 )
{
GameManager.AddLog( "Chaos swaps attack buffs!" );
int temp = player.eventAttackBuff;
player.eventAttackBuff = ai.eventAttackBuff;
ai.eventAttackBuff = temp;
}
else if ( r == 3 )
{
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name}'s electrons go chaotic and fully heals {ai.name}!" );
else GameManager.AddLog( "AI's electrons go chaotic and fully heals the AI!" );
ai.hp = maxAIHp;
}
else if ( r == 4 )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"{ai.name} sends an electric flux towards {player.name} from chaos!" );
if ( manager != null ) manager.IsPlayerOneDazed = true;
}
else
{
GameManager.AddLog( "AI sends an electric flux towards the player from chaos!" );
playerBuff = -999;
}
}
else
{
GameManager.AddLog( $"The machine backfires - both take -{scaleMinorDamage} HP!" );
CombatManager.applyDamage( ref player, scaleMinorDamage );
CombatManager.applyDamage( ref ai, scaleMinorDamage );
}
}
else if ( aSkull == 2 )
{
if ( isMultiplayer ) GameManager.AddLog( $"Two SKULLS - heavy damage for {ai.name}! -{scaleDoubleSkull} HP" );
else GameManager.AddLog( $"AI reeled two SKULLS - heavy damage for AI! -{scaleDoubleSkull} HP" );
CombatManager.applyDamage( ref ai, scaleDoubleSkull );
}
else if ( aHeart == 3 )
{
int totalHeartHealAI = scaleTripleHeart + ai.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"Three HEARTS - {ai.name}'s machine grants robust healing! +{scaleTripleHeart} HP" );
else GameManager.AddLog( $"Three HEARTS - AI machine grants robust healing! +{scaleTripleHeart} HP" );
ai.hp += totalHeartHealAI;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
ai.eventHealingBuff = 0;
}
else if ( aHeart == 2 )
{
int totalHeartHealAI = scaleDoubleHeart + ai.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"Two HEARTS - small {ai.name} healing. +{scaleDoubleHeart} HP" );
else GameManager.AddLog( $"AI reeled two HEARTS - small AI healing. +{scaleDoubleHeart} HP" );
ai.hp += totalHeartHealAI;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
ai.eventHealingBuff = 0;
}
else if ( aSword == 2 )
{
if ( isMultiplayer ) GameManager.AddLog( $"Two SWORDS - modest {ai.name} weapon boost. +{scaleDoubleSword} attack" );
else GameManager.AddLog( $"Two SWORDS - modest AI weapon boost. +{scaleDoubleSword} attack" );
ai.eventAttackBuff += scaleDoubleSword;
}
else if ( aShield == 2 )
{
int totalShieldHealAI = scaleDoubleShield + ai.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"Two SHIELDS - small defensive aid and heal for {ai.name}. +{scaleDoubleShield} HP" );
else GameManager.AddLog( $"Two SHIELDS - small defensive aid and heal for AI. +{scaleDoubleShield} HP" );
ai.hp += totalShieldHealAI;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
ai.eventAttackBuff += 5;
ai.eventHealingBuff = 0;
}
else if ( aBomb >= 1 )
{
if ( Random.Shared.Next( 100 ) < 50 )
{
if ( isMultiplayer ) GameManager.AddLog( $"A stray bomb fragment strikes {ai.name}! -{scaleMinorDamage} HP" );
else GameManager.AddLog( $"A stray bomb fragment strikes the AI! -{scaleMinorDamage} HP" );
CombatManager.applyDamage( ref ai, scaleMinorDamage );
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name}'s rolled bomb fizzled out safely." );
else GameManager.AddLog( "AI's rolled bomb fizzled out safely." );
}
}
else
{
if ( Random.Shared.Next( 100 ) < 50 )
{
int totalMinorHealAI = scaleMinorHeal + ai.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddLog( $"The machine gives {ai.name} a tiny coin +{scaleMinorHeal} HP" );
else GameManager.AddLog( $"The machine gives the AI a tiny coin +{scaleMinorHeal} HP" );
ai.hp += scaleMinorHeal;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
ai.eventHealingBuff = 0;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name}'s reels reset without effect." );
else GameManager.AddLog( "AI's reels reset without effect." );
}
}
// Extra glitch jackpot.
if ( (pCoin == 3 && aCoin == 3) && (Random.Shared.Next( 100 ) < 5) )
{
int scaleHellfireBurn = isMultiplayer ? 30 : 30 + (prestige * 5);
int scaleHellfireRelic = isMultiplayer ? 40 : 40 + (prestige * 6);
GameManager.AddLog( "\n*** 666 HELLFIRE JACKPOT!! The machine tears a hole in the sky! ***" );
GameManager.AddLog( "Both fighters are burned - but then an artifact appears to empower the victor!" );
player.hp -= scaleHellfireBurn;
ai.hp -= scaleHellfireBurn;
if ( player.hp > ai.hp )
{
player.eventAttackBuff += scaleHellfireRelic;
if ( isMultiplayer ) GameManager.AddLog( $"{player.name} finds a cursed relic: +{scaleHellfireRelic} attack!" );
else GameManager.AddLog( $"You find a cursed relic: +{scaleHellfireRelic} attack!" );
}
else
{
ai.eventAttackBuff += scaleHellfireRelic;
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name} finds a cursed relic: +{scaleHellfireRelic} attack!" );
else GameManager.AddLog( $"AI finds a cursed relic: +{scaleHellfireRelic} attack!" );
}
}
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
GameManager.AddLog( "\nThe Slot Machine of Doom closes with a mechanical hum." );
break;
}
case 55:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Calculate prestige-scaled rewards and damage lineally (Flattened to baseline for multiplayer matches)
int scaleDragonDamageBonus = (isMultiplayer ? 0 : prestige * 5);
int scaleDragonStatBonus = (isMultiplayer ? 0 : prestige * 2);
// Establish local stack pointers to satisfy reference variable scopes
var p = player;
var a = ai;
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE REGISTERS
// =========================================================================
int p1DragonChoice = 0;
int p2DragonChoice = 0;
bool isDragonResolved = false;
void ResolveDragonGambit( int choice, Player unit, string displayName, int targetMaxHp )
{
int atkGain = 0;
int defGain = 0;
switch ( choice )
{
// 1. Attack Dragon.
case 1:
{
int dmg = Random.Shared.Next( 20, 51 ) + scaleDragonDamageBonus;
atkGain = Random.Shared.Next( 4, 10 ) + scaleDragonStatBonus;
unit.hp -= dmg;
unit.eventAttackBuff += atkGain;
GameManager.AddLog( $"⚔️ {displayName} strikes the dragon! Takes -{dmg} HP, but absorbs Dragon Blood: +{atkGain} attack bonus next turn." );
break;
}
// 2. Defend.
case 2:
{
int dmg = Random.Shared.Next( 10, 31 ) + scaleDragonDamageBonus;
defGain = Random.Shared.Next( 2, 6 ) + scaleDragonStatBonus;
unit.hp -= dmg;
unit.eventAttackBuff += defGain;
GameManager.AddLog( $"🛡️ {displayName} braces against the flames. -{dmg} HP. Gains Dragon Scales: +{defGain} defense bonus next turn." );
break;
}
// 3. Flee.
case 3:
{
int luck = Random.Shared.Next( 0, 100 );
if ( luck < 35 )
{
GameManager.AddLog( $"🏃 {displayName} escapes untouched!" );
}
else if ( luck < 75 )
{
int dmg = Random.Shared.Next( 10, 36 ) + scaleDragonDamageBonus;
unit.hp -= dmg;
GameManager.AddLog( $"💥 {displayName} fails to escape and is scorched! -{dmg} HP." );
}
else
{
int doom = Random.Shared.Next( 40, 91 ) + scaleDragonDamageBonus;
unit.hp -= doom;
GameManager.AddLog( $"🔥 {displayName} is CRITICALLY struck by the dragon! -{doom} HP." );
}
break;
}
// 4. Negotiate.
case 4:
{
int luck = Random.Shared.Next( 0, 100 );
if ( luck < 10 )
{
atkGain = Random.Shared.Next( 10, 20 ) + scaleDragonStatBonus;
defGain = Random.Shared.Next( 10, 20 ) + scaleDragonStatBonus;
unit.eventAttackBuff += atkGain;
unit.eventAttackBuff += defGain;
GameManager.AddLog( $"✨ {displayName} speaks ancient words. The dragon bows!" );
GameManager.AddLog( $"👑 {displayName} receives DRAGON'S FAVOR: +{atkGain} attack, +{defGain} armor bonus next turn!" );
}
else if ( luck < 50 )
{
int dmg = Random.Shared.Next( 10, 21 ) + scaleDragonDamageBonus;
unit.hp -= dmg;
GameManager.AddLog( $"💥 {displayName}'s words fail. The dragon lashes out! -{dmg} HP." );
}
else
{
int cursePenaltyScale = (isMultiplayer ? 0 : prestige * 1);
int curseAtk = Random.Shared.Next( 2, 6 ) + cursePenaltyScale;
int curseDef = Random.Shared.Next( 2, 6 ) + cursePenaltyScale;
unit.eventAttackBuff -= curseAtk;
unit.eventAttackBuff -= curseDef;
GameManager.AddLog( $"👿 {displayName} angers the dragon!" );
GameManager.AddLog( $"⚠️ Dragon's Curse: -{curseAtk} attack, -{curseDef} defense penalty next turn!" );
}
break;
}
}
if ( unit.hp > targetMaxHp ) unit.hp = targetMaxHp;
if ( unit.hp < 0 ) unit.hp = 0;
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== DRAGON'S GAMBIT ===" );
GameManager.AddLog( "The sky trembles, an Ancient Dragon descends, its presence warping reality." );
GameManager.AddLog( "Both fighters must choose how they face the beast.\n" );
GameManager.AddLog( "⚠️ AWAITING MYSTICAL ENCOUNTER MATRIX STANCE..." );
var multiplayerDragonEvent = new ChoiceEvent
{
Title = "🐉 ANCIENT DRAGON MATRIX INTRUSION",
PromptText = "An Ancient Dragon has ruptured your partition layers. Select your stance matrix profile:",
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1DragonChoice = choiceIndex;
else p2DragonChoice = choiceIndex;
if ( p1DragonChoice > 0 && p2DragonChoice > 0 && !isDragonResolved )
{
isDragonResolved = true;
GameManager.AddLog( $"\n🐉 [DRAGON ENCOUNTER OUTCOME] Symmetrical mystical parameters locked!" );
ResolveDragonGambit( p1DragonChoice, p, p.name, maxPlayerHp );
ResolveDragonGambit( p2DragonChoice, a, a.name, maxAIHp );
GameManager.AddLog( "\nThe dragon ascends into the burning, lightning clouds..." );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their dragon counter-measure profile stance!" );
}
};
multiplayerDragonEvent.Options.Add( new EventOption { ButtonText = "⚔️ ATTACK HEAD-ON (HIGH RISK / STAT GAIN)", ActionToExecute = () => handleNetworkChoice( 1, Networking.IsHost ) } );
multiplayerDragonEvent.Options.Add( new EventOption { ButtonText = "🛡️ BRACE / DEFEND (MODERATE RISK / DEF SCALE)", ActionToExecute = () => handleNetworkChoice( 2, Networking.IsHost ) } );
multiplayerDragonEvent.Options.Add( new EventOption { ButtonText = "🏃 ATTEMPT TO FLEE (LOW ESCAPE CHANCE)", ActionToExecute = () => handleNetworkChoice( 3, Networking.IsHost ) } );
multiplayerDragonEvent.Options.Add( new EventOption { ButtonText = "✨ NEGOTIATE (EXTREME CHANCE / HIGHEST MULTIPLIERS)", ActionToExecute = () => handleNetworkChoice( 4, Networking.IsHost ) } );
GameManager.Instance.TriggerChoicePopup( multiplayerDragonEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career rules
GameManager.AddLog( "\n=== DRAGON'S GAMBIT ===" );
GameManager.AddLog( "The sky trembles, an Ancient Dragon descends, its presence warping reality." );
GameManager.AddLog( "Both fighters must choose how they face the beast.\n" );
GameManager.AddLog( "⚠️ AWAITING MYSTICAL ENCOUNTER MATRIX STANCE..." );
int secretAIChoice = Random.Shared.Next( 1, 5 );
void FinalizeDragonEncounter( int playerChoice )
{
ResolveDragonGambit( playerChoice, p, "Player", maxPlayerHp );
ResolveDragonGambit( secretAIChoice, a, "AI", maxAIHp );
GameManager.AddLog( "\nThe dragon ascends into the burning, lightning clouds..." );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
var dragonEvent = new ChoiceEvent
{
Title = "🐉 ANCIENT DRAGON MATRIX INTRUSION",
PromptText = "An Ancient Dragon has ruptured your partition layers, fracturing reality. Your system controls are frozen. Select your stance matrix profile to confront the beast:",
};
dragonEvent.Options.Add( new EventOption { ButtonText = "⚔️ ATTACK HEAD-ON (HIGH RISK / STAT GAIN)", ActionToExecute = () => FinalizeDragonEncounter( 1 ) } );
dragonEvent.Options.Add( new EventOption { ButtonText = "🛡️ BRACE / DEFEND (MODERATE RISK / DEF SCALE)", ActionToExecute = () => FinalizeDragonEncounter( 2 ) } );
dragonEvent.Options.Add( new EventOption { ButtonText = "🏃 ATTEMPT TO FLEE (LOW ESCAPE CHANCE)", ActionToExecute = () => FinalizeDragonEncounter( 3 ) } );
dragonEvent.Options.Add( new EventOption { ButtonText = "✨ NEGOTIATE (EXTREME CHANCE / HIGHEST MULTIPLIERS)", ActionToExecute = () => FinalizeDragonEncounter( 4 ) } );
GameManager.Instance.TriggerChoicePopup( dragonEvent );
}
break;
}
case 56:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
// Calculate scaled prestige modifications (Gated to 0 baseline for competitive multiplayer matches)
int scaleFlipStatGain = isMultiplayer ? 0 : prestige * 1;
int scaleFlipPunishment = isMultiplayer ? 0 : prestige * 3;
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== COIN OF FATE ===" );
GameManager.AddLog( "A silver gleaming coin falls from the sky, fate demands a simultaneous flip from both players!" );
}
else
{
GameManager.AddLog( "\n=== COIN OF FATE ===" );
GameManager.AddLog( "A silver gleaming coin falls from the sky, fate demands a flip!" );
}
// Marked with local scoping wrapper
void Flip( string who, ref Player unit )
{
int roll = Random.Shared.Next( 0, 2 ); // 0 = bad, 1 = good.
if ( roll == 1 )
{
int baseGain = Random.Shared.Next( 5, 11 ); // +5 to 10 attack base
int totalGain = baseGain + scaleFlipStatGain;
unit.eventAttackBuff += totalGain;
GameManager.AddLog( $"🪙 {who} wins the flip! +{totalGain} attack bonus next turn!" );
}
else
{
int baseDmg = Random.Shared.Next( 10, 35 ); // 10-34 HP base
int totalDmg = baseDmg + scaleFlipPunishment;
unit.hp -= totalDmg;
GameManager.AddLog( $"💥 {who} loses the flip! -{totalDmg} HP!" );
}
if ( unit.hp < 0 ) unit.hp = 0;
}
Flip( player.name, ref player );
Flip( ai.name, ref ai );
break;
}
case 57:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
// Calculate scaled prestige modifications (Flattened to baseline for multiplayer matches)
int scaleGuessAtkGain = isMultiplayer ? 0 : prestige * 1;
int scaleGuessDmgPenalty = isMultiplayer ? 0 : prestige * 2;
var p = player;
var a = ai;
int secret = Random.Shared.Next( 1, 6 );
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE PROTOCOLS
// =========================================================================
int p1GuessChoice = 0;
int p2GuessChoice = 0;
bool isGuessResolved = false;
void EvaluateGuessResults( int playerGuess, int opponentGuess )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"🔢 {p.name} guess: {playerGuess}" );
GameManager.AddLog( $"🔢 {a.name} guess: {opponentGuess}" );
GameManager.AddLog( $"🔑 The secret number was: {secret}!\n" );
}
else
{
GameManager.AddLog( $"You guess: {playerGuess}" );
GameManager.AddLog( $"AI guesses: {opponentGuess}" );
GameManager.AddLog( $"The secret number was: {secret}!\n" );
}
// --- PLAYER 1 OUTCOME ---
if ( playerGuess == secret )
{
int baseGain = Random.Shared.Next( 5, 11 );
int finalGain = baseGain + scaleGuessAtkGain;
p.eventAttackBuff += finalGain;
GameManager.AddLog( $"🏆 {p.name} guessed correctly! +{finalGain} attack bonus next turn!" );
}
else
{
int baseDmg = Random.Shared.Next( 5, 21 );
int finalDmg = baseDmg + scaleGuessDmgPenalty;
CombatManager.applyDamage( ref p, finalDmg );
if ( p.hp < 0 ) p.hp = 0;
GameManager.AddLog( $"❌ {p.name} guessed wrong! Losing {finalDmg} HP!" );
}
// --- PLAYER 2 OUTCOME ---
if ( opponentGuess == secret )
{
int baseGain = Random.Shared.Next( 5, 11 );
int finalGain = baseGain + scaleGuessAtkGain;
a.eventAttackBuff += finalGain;
if ( isMultiplayer ) GameManager.AddLog( $"🏆 {a.name} guessed correctly! +{finalGain} attack bonus next turn!" );
else GameManager.AddLog( $"AI guessed correctly! AI gains +{finalGain} attack bonus next turn!" );
}
else
{
int baseDmg = Random.Shared.Next( 5, 21 );
int finalDmg = baseDmg + scaleGuessDmgPenalty;
CombatManager.applyDamage( ref a, finalDmg );
if ( a.hp < 0 ) a.hp = 0;
if ( isMultiplayer ) GameManager.AddLog( $"❌ {a.name} guessed wrong! Losing {finalDmg} HP!" );
else GameManager.AddLog( $"AI guessed wrong! AI loses {finalDmg} HP!" );
}
GameManager.AddLog( "=========================" );
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== GUESS THE NUMBER ===" );
GameManager.AddLog( "A hidden number from 1 to 5 has been chosen. Both players must submit their predictions!" );
GameManager.AddLog( "⚠️ AWAITING TERMINAL NUMERICAL PREDICTIONS..." );
var multiplayerGuessEvent = new ChoiceEvent
{
Title = "🔢 CORE NUMERICAL PREDICTION",
PromptText = "An encrypted tracking packet ranging from 1 to 5 has populated. Input your terminal vector guess:",
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1GuessChoice = choiceIndex;
else p2GuessChoice = choiceIndex;
if ( p1GuessChoice > 0 && p2GuessChoice > 0 && !isGuessResolved )
{
isGuessResolved = true;
GameManager.AddLog( $"\n🔢 [PREDICTION VERIFICATION] Symmetrical data arrays received!" );
EvaluateGuessResults( p1GuessChoice, p2GuessChoice );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their numerical prediction vector payload!" );
}
};
for ( int num = 1; num <= 5; num++ )
{
int currentNum = num;
multiplayerGuessEvent.Options.Add( new EventOption
{
ButtonText = $"[{currentNum}]",
ActionToExecute = () => handleNetworkChoice( currentNum, Networking.IsHost )
} );
}
GameManager.Instance.TriggerChoicePopup( multiplayerGuessEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career rules
GameManager.AddLog( "\n=== GUESS THE NUMBER ===" );
GameManager.AddLog( "A hidden number from 1 to 5 has been chosen." );
GameManager.AddLog( "⚠️ AWAITING TERMINAL NUMERICAL PREDICTION..." );
int aiGuess = Random.Shared.Next( 1, 6 );
var guessEvent = new ChoiceEvent
{
Title = "🔢 CORE NUMERICAL PREDICTION",
PromptText = "The AI firewall has generated an encrypted single-digit tracking packet ranging from 1 to 5. Input your terminal vector guess to stabilize the data lines:",
};
for ( int num = 1; num <= 5; num++ )
{
int currentNum = num;
guessEvent.Options.Add( new EventOption
{
ButtonText = $"[{currentNum}]",
ActionToExecute = () => { EvaluateGuessResults( currentNum, aiGuess ); }
} );
}
GameManager.Instance.TriggerChoicePopup( guessEvent );
}
break;
}
case 58:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
// Calculate scaled prestige modifications (Flattened to baseline for competitive multiplayer matches)
int scaleTriviaAtkGain = isMultiplayer ? 10 : 10 + (prestige * 1);
int scaleTriviaDmgPenalty = isMultiplayer ? 10 : 10 + (prestige * 2);
var p = player;
var a = ai;
int triviaCase = Random.Shared.Next( 0, 5 );
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE REGISTERS
// =========================================================================
int p1TriviaChoice = 0;
int p2TriviaChoice = 0;
bool isTriviaResolved = false;
void ProcessTriviaOutcome( int playerGuess, int opponentGuess, int correctAnswer )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"🧠 {p.name} picks: {(playerGuess == -1 ? "TIMEOUT" : playerGuess.ToString())}" );
GameManager.AddLog( $"🧠 {a.name} picks: {(opponentGuess == -1 ? "TIMEOUT" : opponentGuess.ToString())}" );
GameManager.AddLog( $"🔑 Correct answer was: {correctAnswer}\n" );
}
else
{
GameManager.AddLog( $"You pick: {playerGuess}" );
GameManager.AddLog( $"AI picks: {opponentGuess}" );
GameManager.AddLog( $"Correct answer: {correctAnswer}\n" );
}
// PLAYER 1 RESULT EVALUATION
if ( playerGuess == correctAnswer )
{
GameManager.AddLog( $"🏆 {p.name} is correct! +{scaleTriviaAtkGain} attack bonus next turn!" );
p.eventAttackBuff += scaleTriviaAtkGain;
}
else
{
string reason = (playerGuess == -1) ? "timed out" : "is wrong";
GameManager.AddLog( $"❌ {p.name} {reason}! -{scaleTriviaDmgPenalty} HP!" );
CombatManager.applyDamage( ref p, scaleTriviaDmgPenalty );
}
// PLAYER 2 RESULT EVALUATION
if ( opponentGuess == correctAnswer )
{
if ( isMultiplayer ) GameManager.AddLog( $"🏆 {a.name} is correct! +{scaleTriviaAtkGain} attack bonus next turn!" );
else GameManager.AddLog( $"AI is correct! +{scaleTriviaAtkGain} attack bonus next turn!" );
a.eventAttackBuff += scaleTriviaAtkGain;
}
else
{
string reason = (opponentGuess == -1) ? "timed out" : "is wrong";
if ( isMultiplayer ) GameManager.AddLog( $"❌ {a.name} {reason}! -{scaleTriviaDmgPenalty} HP!" );
else GameManager.AddLog( $"AI is wrong! -{scaleTriviaDmgPenalty} HP!" );
CombatManager.applyDamage( ref a, scaleTriviaDmgPenalty );
}
if ( p.hp < 0 ) p.hp = 0;
if ( a.hp < 0 ) a.hp = 0;
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
// =========================================================================
// Configure our structured trivia text and answers setup
string promptTitle = "🧠 CYBERNETIC TRIVIA GAUNTLET";
string questionText = "";
int correctIndex = 1;
string[] choices = new string[6];
switch ( triviaCase )
{
case 0:
questionText = "Which planet has the most moons?";
correctIndex = 4; // Saturn
choices = new string[] { "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" };
break;
case 1:
questionText = "Who was the first President of the United States?";
correctIndex = 5; // Washington
choices = new string[] { "Adams", "Jefferson", "Lincoln", "Roosevelt", "Washington", "Franklin" };
break;
case 2:
questionText = "What part of the cell contains DNA?";
correctIndex = 3; // Nucleus
choices = new string[] { "Cytoplasm", "Membrane", "Nucleus", "Ribosome", "Lysosome", "Mitochondria" };
break;
case 3:
questionText = "What is the Earth's largest ocean?";
correctIndex = 5; // Pacific
choices = new string[] { "Atlantic", "Indian", "Arctic", "Southern", "Pacific", "Dead Sea" };
break;
case 4:
questionText = "Which video game franchise features a character named Master Chief?";
correctIndex = 2; // Halo
choices = new string[] { "Gears of War", "Halo", "Doom", "Half-Life 2", "Destiny", "Titanfall" };
break;
}
GameManager.AddLog( $"\n[Trivia] {questionText}" );
if ( isMultiplayer )
{
var multiplayerTriviaEvent = new ChoiceEvent
{
Title = promptTitle,
PromptText = $"Category Packet #{triviaCase} Unsealed. Question: \"{questionText}\" Select the absolute truth vector before the firewall closes:",
HasTimeLimit = true,
TimeRemaining = 10f,
TotalDuration = 10f,
OnTimeoutAction = () =>
{
// Force an absolute fallback index (-1) for whoever timed out out-of-turn
if ( Networking.IsHost && p1TriviaChoice == 0 ) p1TriviaChoice = -1;
if ( !Networking.IsHost && p2TriviaChoice == 0 ) p2TriviaChoice = -1;
if ( (p1TriviaChoice != 0 && p2TriviaChoice != 0) && !isTriviaResolved )
{
isTriviaResolved = true;
ProcessTriviaOutcome( p1TriviaChoice, p2TriviaChoice, correctIndex );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
}
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1TriviaChoice = choiceIndex;
else p2TriviaChoice = choiceIndex;
if ( p1TriviaChoice != 0 && p2TriviaChoice != 0 && !isTriviaResolved )
{
isTriviaResolved = true;
GameManager.AddLog( $"\n🧠 [NET TRIVIA MARQUEE] Symmetrical knowledge packets verified!" );
ProcessTriviaOutcome( p1TriviaChoice, p2TriviaChoice, correctIndex );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their trivia truth index packet!" );
}
};
for ( int choiceNum = 1; choiceNum <= 6; choiceNum++ )
{
int currentChoiceIndex = choiceNum;
string currentChoiceText = choices[choiceNum - 1];
multiplayerTriviaEvent.Options.Add( new EventOption
{
ButtonText = $"{currentChoiceIndex}. {currentChoiceText.ToUpper()}",
ActionToExecute = () => handleNetworkChoice( currentChoiceIndex, Networking.IsHost )
} );
}
GameManager.Instance.TriggerChoicePopup( multiplayerTriviaEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career countdown loops
int aiGuess = Random.Shared.Next( 1, 7 );
var triviaEvent = new ChoiceEvent
{
Title = promptTitle,
PromptText = $"Category Packet #{triviaCase} Unsealed. Question: \"{questionText}\" Select the absolute truth vector below to authorize rewards:",
HasTimeLimit = true,
TimeRemaining = 10f,
TotalDuration = 10f,
OnTimeoutAction = () =>
{
GameManager.AddLog( $"❌ TIMER EXPIRED! You failed to submit data to the mainframe before the firewall closed! -{scaleTriviaDmgPenalty} HP!" );
CombatManager.applyDamage( ref p, scaleTriviaDmgPenalty );
if ( p.hp < 0 ) p.hp = 0;
if ( aiGuess == correctIndex )
{
GameManager.AddLog( $"AI is correct! +{scaleTriviaAtkGain} attack bonus next turn!" );
a.eventAttackBuff += scaleTriviaAtkGain;
}
else
{
GameManager.AddLog( $"AI is wrong! -{scaleTriviaDmgPenalty} HP!" );
CombatManager.applyDamage( ref a, scaleTriviaDmgPenalty );
}
if ( a.hp < 0 ) a.hp = 0;
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
};
for ( int choiceNum = 1; choiceNum <= 6; choiceNum++ )
{
int currentChoiceIndex = choiceNum;
string currentChoiceText = choices[choiceNum - 1];
triviaEvent.Options.Add( new EventOption
{
ButtonText = $"{currentChoiceIndex}. {currentChoiceText.ToUpper()}",
ActionToExecute = () => { ProcessTriviaOutcome( currentChoiceIndex, aiGuess, correctIndex ); }
} );
}
GameManager.Instance.TriggerChoicePopup( triviaEvent );
}
break;
}
case 59:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
// Calculate scaled prestige modifications (Flattened to baseline for competitive multiplayer matches)
int scaledDefusalReward = isMultiplayer ? 15 : 15 + (prestige * 2);
int scaledDetonationDamage = isMultiplayer ? 25 : 25 + (prestige * 4);
var p = player;
var a = ai;
int correctWire = Random.Shared.Next( 0, 2 );
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE REGISTERS
// =========================================================================
int p1WireChoice = -2; // 0=Red, 1=Blue, -2=Unset, -1=Timeout
int p2WireChoice = -2;
bool isBombResolved = false;
void ProcessWireCutOutcome( int playerChoice, int opponentChoice )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"✂️ {p.name} chooses: {(playerChoice == -1 ? "TIMEOUT" : (playerChoice == 0 ? "Red" : "Blue"))}" );
GameManager.AddLog( $"✂️ {a.name} chooses: {(opponentChoice == -1 ? "TIMEOUT" : (opponentChoice == 0 ? "Red" : "Blue"))}" );
GameManager.AddLog( $"🔑 The correct defusal wire vector was: {(correctWire == 0 ? "Red" : "Blue")}!\n" );
}
else
{
GameManager.AddLog( $"You choose: {(playerChoice == 0 ? "Red" : "Blue")}" );
GameManager.AddLog( $"AI chooses: {(opponentChoice == 0 ? "Red" : "Blue")}" );
}
// --- PLAYER 1 / HOST RESOLUTION ---
if ( playerChoice == correctWire )
{
if ( isMultiplayer ) GameManager.AddLog( $"🏆 {p.name} cut the CORRECT wire! {a.name} suffers -{scaledDefusalReward} HP!" );
else GameManager.AddLog( $"You cut the CORRECT wire! AI -{scaledDefusalReward} HP!" );
CombatManager.applyDamage( ref a, scaledDefusalReward );
}
else
{
if ( playerChoice == -1 ) GameManager.AddLog( $"💥 TIMER EXPIRED! The bomb detonated on {p.name} from hesitation! -{scaledDetonationDamage} HP!" );
else GameManager.AddLog( $"💥 WRONG WIRE! It explodes in {p.name}'s face! Taking -{scaledDetonationDamage} HP!" );
CombatManager.applyDamage( ref p, scaledDetonationDamage );
}
// --- PLAYER 2 / CLIENT RESOLUTION ---
if ( opponentChoice == correctWire )
{
if ( isMultiplayer ) GameManager.AddLog( $"🏆 {a.name} ALSO cut the correct wire! {p.name} takes -{scaledDefusalReward} damage!" );
else GameManager.AddLog( $"AI ALSO cut the correct wire! You take {scaledDefusalReward} damage!" );
CombatManager.applyDamage( ref p, scaledDefusalReward );
}
else
{
if ( isMultiplayer )
{
if ( opponentChoice == -1 ) GameManager.AddLog( $"💥 TIMER EXPIRED! The bomb detonated on {a.name} from hesitation! -{scaledDetonationDamage} HP!" );
else GameManager.AddLog( $"💥 {a.name} cut the wrong wire and got bombed! -{scaledDetonationDamage} HP!" );
}
else
{
GameManager.AddLog( $"💥 AI cut the wrong wire and got bombed! AI -{scaledDetonationDamage} HP!" );
}
CombatManager.applyDamage( ref a, scaledDetonationDamage );
}
if ( p.hp < 0 ) p.hp = 0;
if ( a.hp < 0 ) a.hp = 0;
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== BOMB DEFUSE: RED WIRE / BLUE WIRE ===" );
GameManager.AddLog( "⚠️ WARNING: TIMEBOMB INTRUSION DETECTED! FIREWALL IS LOCKING OUT..." );
var multiplayerBombEvent = new ChoiceEvent
{
Title = "💣 DISARM PROTOCOL CRITICAL",
PromptText = "A hazardous logic timebomb has attached itself to the workspace. You must isolate a single pathway before core detonation occurs. Cut a wire immediately!",
HasTimeLimit = true,
TimeRemaining = 5f,
TotalDuration = 5f,
OnTimeoutAction = () =>
{
// Force timeout markers safely if they missed the clock window
if ( Networking.IsHost && p1WireChoice == -2 ) p1WireChoice = -1;
if ( !Networking.IsHost && p2WireChoice == -2 ) p2WireChoice = -1;
if ( (p1WireChoice != -2 && p2WireChoice != -2) && !isBombResolved )
{
isBombResolved = true;
ProcessWireCutOutcome( p1WireChoice, p2WireChoice );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
}
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1WireChoice = choiceIndex;
else p2WireChoice = choiceIndex;
if ( p1WireChoice != -2 && p2WireChoice != -2 && !isBombResolved )
{
isBombResolved = true;
GameManager.AddLog( $"\n💣 [NET DEFUSAL MARQUEE] Symmetrical wire cut parameters received!" );
ProcessWireCutOutcome( p1WireChoice, p2WireChoice );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} prepared their wire-cut tools!" );
}
};
multiplayerBombEvent.Options.Add( new EventOption { ButtonText = "🔴 CUT RED WIRE", ActionToExecute = () => handleNetworkChoice( 0, Networking.IsHost ) } );
multiplayerBombEvent.Options.Add( new EventOption { ButtonText = "🔵 CUT BLUE WIRE", ActionToExecute = () => handleNetworkChoice( 1, Networking.IsHost ) } );
GameManager.Instance.TriggerChoicePopup( multiplayerBombEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career countdown loops
int aiChoice = Random.Shared.Next( 0, 2 );
var bombEvent = new ChoiceEvent
{
Title = "💣 DISARM PROTOCOL CRITICAL",
PromptText = "A hazardous logic timebomb has attached itself to the kernel workspace. You must isolate a single data link pathway before core detonation occurs. Cut a wire immediately!",
HasTimeLimit = true,
TimeRemaining = 5f,
TotalDuration = 5f,
OnTimeoutAction = () =>
{
GameManager.AddLog( $"💥 TIMER EXPIRED! The bomb detonated while you hesitated! You take maximum damage! -{scaledDetonationDamage} HP!" );
CombatManager.applyDamage( ref p, scaledDetonationDamage );
if ( p.hp < 0 ) p.hp = 0;
if ( aiChoice == correctWire )
{
GameManager.AddLog( $"AI cut the correct wire! You take {scaledDefusalReward} damage!" );
CombatManager.applyDamage( ref p, scaledDefusalReward );
}
else
{
GameManager.AddLog( $"💥 AI also cut the wrong wire and got bombed! AI -{scaledDetonationDamage} HP!" );
CombatManager.applyDamage( ref a, scaledDetonationDamage );
}
if ( p.hp < 0 ) p.hp = 0;
if ( a.hp < 0 ) a.hp = 0;
GameManager.AddLog( $"{p.name} | HP: {p.hp} | Armor: {p.defense}" );
GameManager.AddLog( $"{a.name} | HP: {a.hp} | Armor: {a.defense}" );
}
};
bombEvent.Options.Add( new EventOption { ButtonText = "🔴 CUT RED WIRE", ActionToExecute = () => { ProcessWireCutOutcome( 0, aiChoice ); } } );
bombEvent.Options.Add( new EventOption { ButtonText = "🔵 CUT BLUE WIRE", ActionToExecute = () => { ProcessWireCutOutcome( 1, aiChoice ); } } );
GameManager.Instance.TriggerChoicePopup( bombEvent );
}
break;
}
case 60:
{
GameManager.AddLog( "\n=== MINI SLOT MACHINE ===" );
// 1. Fetch current scene progression data securely upfront
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// 2. Scale the jackpot reward lineally (Flattened to baseline for multiplayer matches)
int finalPlayerJackpot = 50 + ((isMultiplayer ? 0 : prestige) * 8) + player.eventHealingBuff;
int finalAIJackpot = 50 + ((isMultiplayer ? 0 : prestige) * 8) + ai.eventHealingBuff;
int baseDamageJackpot = 50 + ((isMultiplayer ? 0 : prestige) * 8);
// FIX: Use 1, 5 bounds for standard exclusive C# Random.Next logic to roll 1, 2, 3, or 4
int p1 = Random.Shared.Next( 1, 5 );
int p2 = Random.Shared.Next( 1, 5 );
int p3 = Random.Shared.Next( 1, 5 );
if ( isMultiplayer ) GameManager.AddLog( $"{player.name} rolled: [{p1}][{p2}][{p3}]" );
else GameManager.AddLog( $"You rolled: [{p1}][{p2}][{p3}]" );
bool playerWin = (p1 == p2 && p2 == p3);
int a1 = Random.Shared.Next( 1, 5 );
int a2 = Random.Shared.Next( 1, 5 );
int a3 = Random.Shared.Next( 1, 5 );
if ( isMultiplayer ) GameManager.AddLog( $"{ai.name} rolled: [{a1}][{a2}][{a3}]" );
else GameManager.AddLog( $"AI rolled: [{a1}][{a2}][{a3}]" );
bool aiWin = (a1 == a2 && a2 == a3);
// 3. Apply the updated jackpot values using the object buffers
if ( playerWin && !aiWin )
{
if ( isMultiplayer ) GameManager.AddLog( $"\n🏆 {player.name.ToUpper()} HITS THE JACKPOT! +{finalPlayerJackpot} HP, {ai.name} -{baseDamageJackpot} HP!" );
else GameManager.AddLog( $"\nYOU HIT THE JACKPOT! +{finalPlayerJackpot} HP, AI -{baseDamageJackpot} HP!" );
player.hp += finalPlayerJackpot;
CombatManager.applyDamage( ref ai, baseDamageJackpot );
player.eventHealingBuff = 0;
}
else if ( aiWin && !playerWin )
{
if ( isMultiplayer ) GameManager.AddLog( $"\n🏆 {ai.name.ToUpper()} HITS THE JACKPOT! -{baseDamageJackpot} HP, {ai.name} +{finalAIJackpot} HP!" );
else GameManager.AddLog( $"\nAI HIT THE JACKPOT! -{baseDamageJackpot} HP, AI +{finalAIJackpot} HP!" );
ai.hp += finalAIJackpot;
CombatManager.applyDamage( ref player, baseDamageJackpot );
ai.eventHealingBuff = 0;
}
else if ( playerWin && aiWin )
{
if ( isMultiplayer ) GameManager.AddLog( $"\n🎰 DOUBLE JACKPOT!! {player.name} gains +{finalPlayerJackpot} HP and {ai.name} gains +{finalAIJackpot} HP!" );
else GameManager.AddLog( $"\nDOUBLE JACKPOT!! You gain +{finalPlayerJackpot} HP and AI gains +{finalAIJackpot} HP!" );
player.hp += finalPlayerJackpot;
ai.hp += finalAIJackpot;
player.eventHealingBuff = 0;
ai.eventHealingBuff = 0;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( "\nNo jackpots... The reels reset with a mechanical hum." );
else GameManager.AddLog( "\nNo jackpots.. Insert another coin." );
}
if ( player.hp > maxPlayerHp ) player.hp = maxPlayerHp;
if ( ai.hp > maxAIHp ) ai.hp = maxAIHp;
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
GameManager.AddLog( $"{player.name} | HP: {player.hp} | Armor: {player.defense}" );
GameManager.AddLog( $"{ai.name} | HP: {ai.hp} | Armor: {ai.defense}" );
break;
}
case 61:
{
UnoDuelEventRunner.StartEvent( player, ai );
break;
}
case 62:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
if ( isMultiplayer ) GameManager.AddLog( "\n=== CHAOS ARENA NETWORK SYNC ===" );
else GameManager.AddLog( "\n=== CHAOS ARENA (TEST) ===" );
// Scale NPC health, attack, and event penalty damage lineally (+4 to +5 per prestige level)
int scaledGoblinHp = 40 + (prestige * 6);
int scaledGoblinAtk = 8 + (prestige * 1);
int scaledOrcHp = 60 + (prestige * 9);
int scaledOrcAtk = 12 + (prestige * 1);
int scaledArenaDamage = 20 + (prestige * 4);
string goblinName = isMultiplayer ? "Goblin" : $"Goblin (Lv.{prestige})";
string orcName = isMultiplayer ? "Orc" : $"Orc (Lv.{prestige})";
List<EventFighter> fighters = new List<EventFighter>()
{
new EventFighter(player.name, player.hp, player.attack, false),
new EventFighter(ai.name, ai.hp, ai.attack, true),
new EventFighter(goblinName, scaledGoblinHp, scaledGoblinAtk, true),
new EventFighter(orcName, scaledOrcHp, scaledOrcAtk, true)
};
int lowestRoll = 999;
int loserIndex = 0;
for ( int i = 0; i < fighters.Count; i++ )
{
int roll = Random.Shared.Next( 100 );
GameManager.AddLog( $"{fighters[i].Name} rolls {roll}" );
if ( roll < lowestRoll )
{
lowestRoll = roll;
loserIndex = i;
}
}
GameManager.AddLog( $"{fighters[loserIndex].Name} loses the challenge! -{scaledArenaDamage} HP" );
EventFighter temp = fighters[loserIndex];
temp.Hp -= scaledArenaDamage;
fighters[loserIndex] = temp;
// Direct Impact Lane: Re-assign the middle-of-a-match modifications cleanly
foreach ( EventFighter f in fighters )
{
if ( f.Name == player.name )
player.hp = f.Hp;
if ( f.Name == ai.name )
ai.hp = f.Hp;
}
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
GameManager.AddLog( "\nChaos Arena ends!" );
break;
}
case 63:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
GameManager.AddLog( "\n=== MEGA ARENA ===" );
// Scale background fighters and arena splash damage lineally (+3 to +4 per tier)
int scaledGoblinHp = 40 + (prestige * 6);
int scaledGoblinAtk = 8 + (prestige * 1);
int scaledOrcHp = 60 + (prestige * 9);
int scaledOrcAtk = 12 + (prestige * 1);
int scaledArenaDamage = 15 + (prestige * 3);
string goblinName = isMultiplayer ? "Goblin" : $"Goblin (Lv.{prestige})";
string orcName = isMultiplayer ? "Orc" : $"Orc (Lv.{prestige})";
List<EventFighter> fighters = new List<EventFighter>()
{
new EventFighter(player.name, player.hp, player.attack, false),
new EventFighter(ai.name, ai.hp, ai.attack, true),
new EventFighter(goblinName, scaledGoblinHp, scaledGoblinAtk, true),
new EventFighter(orcName, scaledOrcHp, scaledOrcAtk, true)
};
List<int> rolls = new List<int>();
int totalRoll = 0;
for ( int i = 0; i < fighters.Count; i++ )
{
int roll = Random.Shared.Next( 1, 5 ); // 1 to 4 inclusive
rolls.Add( roll );
totalRoll += roll;
GameManager.AddLog( $"{fighters[i].Name} chooses {totalRoll}" );
}
GameManager.AddLog( $"\nTotal Roll Value: {totalRoll}" );
int damage = 0;
if ( totalRoll <= 6 )
{
damage = fighters.Count;
}
else if ( totalRoll <= 9 )
{
damage = 3;
}
else if ( totalRoll <= 12 )
{
damage = 2;
}
else if ( totalRoll <= 15 )
{
damage = 1;
}
else
{
damage = 0;
}
GameManager.AddLog( $"{damage} fighter(s) will take {scaledArenaDamage} damage!" );
for ( int i = 0; i < damage; i++ )
{
int target = Random.Shared.Next( fighters.Count );
EventFighter temp = fighters[target];
temp.Hp -= scaledArenaDamage;
fighters[target] = temp;
GameManager.AddLog( $"{temp.Name} takes {scaledArenaDamage} damage!" );
}
// Direct Impact Lane: Commit remaining health thresholds back to core entities
foreach ( EventFighter f in fighters )
{
if ( f.Name == player.name )
player.hp = f.Hp;
if ( f.Name == ai.name )
ai.hp = f.Hp;
}
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
GameManager.AddLog( "\n=== EVENT CONCLUDED ===" );
break;
}
case 64:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
if ( isMultiplayer ) GameManager.AddLog( "\n=== MEGA ARENA WITH NETWORK STATS ===" );
else GameManager.AddLog( "\n=== MEGA ARENA WITH STATS ===" );
// Scale background fighters lineally
int scaledGoblinHp = 40 + (prestige * 6);
int scaledGoblinAtk = 8 + (prestige * 1);
int scaledOrcHp = 60 + (prestige * 9);
int scaledOrcAtk = 12 + (prestige * 1);
string goblinName = isMultiplayer ? "Goblin" : $"Goblin (Lv.{prestige})";
string orcName = isMultiplayer ? "Orc" : $"Orc (Lv.{prestige})";
List<EventFighter> fighters = new List<EventFighter>()
{
new EventFighter(player.name, player.hp, player.attack, false),
new EventFighter(ai.name, ai.hp, ai.attack, true),
new EventFighter(goblinName, scaledGoblinHp, scaledGoblinAtk, true),
new EventFighter(orcName, scaledOrcHp, scaledOrcAtk, true)
};
// Scale baseline stat curves per prestige level (+1 to +2 per level) to match players
List<int> strength = new List<int>() { 15, 12, 8 + (prestige * 1), 18 + (prestige * 2) };
List<int> agility = new List<int>() { 12, 10, 15 + (prestige * 2), 6 + (prestige * 1) };
List<int> luck = new List<int>() { 10, 8, 5 + (prestige * 1), 4 + (prestige * 1) };
List<int> defense = new List<int>() { 10, 9, 6 + (prestige * 1), 14 + (prestige * 2) };
for ( int i = 0; i < fighters.Count; i++ )
{
int baseRoll = Random.Shared.Next( 1, 101 );
int statBonus =
(strength[i] / 2) +
(agility[i] / 3) +
(luck[i] / 4);
int finalRoll = baseRoll + statBonus;
GameManager.AddLog( $"{fighters[i].Name} rolls {baseRoll} + stat bonus {statBonus} = {finalRoll}" );
int threshold = 60 - (defense[i] / 2);
if ( finalRoll < threshold )
{
// Scale failure penalty lineally with prestige (+3 damage per prestige level)
int baseDamage = 20 - (defense[i] / 4);
int scaledFailDamage = baseDamage + (prestige * 3);
if ( scaledFailDamage < 5 )
scaledFailDamage = 5;
EventFighter temp = fighters[i];
temp.Hp -= scaledFailDamage;
fighters[i] = temp;
GameManager.AddLog( $"💥 {fighters[i].Name} FAILS and takes {scaledFailDamage} damage!" );
}
else
{
GameManager.AddLog( $"🛡️ {fighters[i].Name} succeeds and avoids damage!" );
}
}
// Direct Impact Lane: Safely commit the remaining HP metrics back to the core models
foreach ( EventFighter f in fighters )
{
if ( f.Name == player.name )
player.hp = f.Hp;
if ( f.Name == ai.name )
ai.hp = f.Hp;
}
if ( player.hp < 0 ) player.hp = 0;
if ( ai.hp < 0 ) ai.hp = 0;
GameManager.AddLog( "=== EVENT COMPLETE ===" );
break;
}
case 65:
{
GameManager.AddLog( "\n=== MAGIC EVENT: MANA WELL LEAK ===" );
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
int scaledManaJolt = 20 + (prestige * 5);
GameManager.AddLog( $"** A tear in the local server grid erupts into a font of raw energy! Both fighters inhale the residue! +{scaledManaJolt} SP! **" );
player.magic += scaledManaJolt;
ai.magic += scaledManaJolt;
if ( player.magic > 100 ) player.magic = 100;
if ( ai.magic > 100 ) ai.magic = 100;
GameManager.AddLog( $"{player.name} SP: {player.magic}/100 | {ai.name} SP: {ai.magic}/100" );
break;
}
case 66:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Daemon witch offers elixir to Player 2 instead!
}
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== MAGIC EVENT: WITCH'S BREW CONCOCTION ===" );
GameManager.AddLog( $"** An ancient network daemon manifests as a digital witch, offering a shimmering data vial to {target.name}... **" );
GameManager.AddLog( "⚠️ AWAITING ARCANE SELECTION INTRUSION..." );
}
else
{
GameManager.AddLog( "\n=== MAGIC EVENT: WITCH'S BREW CONCOCTION ===" );
GameManager.AddLog( "** An ancient network daemon manifests as a digital witch, offering a shimmering data vial... **" );
GameManager.AddLog( "⚠️ AWAITING ARCANE SELECTION INTRUSION..." );
}
int scaledSipMana = 40 + (prestige * 5);
int scaledSmashBuff = 15 + (prestige * 3);
int scaledVialExplode = 20 + (prestige * 4);
var p = target;
var witchVialEvent = new ChoiceEvent
{
Title = "🧪 THE DAEMON'S WITCH BREW",
PromptText = isMultiplayer
? $"A glitching network witch presents a highly concentrated mana elixir file partition to {p.name}. What vector action will you execute?"
: "A glitching network witch presents a highly concentrated mana elixir file partition. Will you drink it or smash it against your weapon frame?",
};
// --- BUTTON 1: DRINK VIAL ---
witchVialEvent.Options.Add( new EventOption
{
ButtonText = "🧪 DRINK THE VIAL (MANA GAMBLE)",
ActionToExecute = () =>
{
int luck = Random.Shared.Next( 100 );
if ( luck < 75 )
{
if ( isMultiplayer ) GameManager.AddLog( $"{p.name}'s circuit pathways supercharge! +{scaledSipMana} SP!" );
else GameManager.AddLog( $"The fluid tastes like cold copper! Your circuit pathways supercharge! +{scaledSipMana} SP!" );
p.magic += scaledSipMana;
if ( p.magic > 100 ) p.magic = 100;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"The volatile mixture rejects {p.name}'s hardware architecture and explodes internally! -{scaledVialExplode} HP!" );
else GameManager.AddLog( $"The volatile mixture rejects your hardware architecture and explodes internally! -{scaledVialExplode} HP!" );
CombatManager.applyDamage( ref p, scaledVialExplode );
}
GameManager.AddLog( $"{p.name} | HP: {p.hp} | SP: {p.magic}/100" );
}
} );
// --- BUTTON 2: SMASH ON WEAPON ---
witchVialEvent.Options.Add( new EventOption
{
ButtonText = "💥 SMASH ON WEAPON (GUARANTEED ATK)",
ActionToExecute = () =>
{
if ( isMultiplayer ) GameManager.AddLog( $"{p.name} shatters the vial over their weapon! Ethereal fire coats the blade! +{scaledSmashBuff} damage next round!" );
else GameManager.AddLog( $"You shatter the vial over your weapon! Ethereal fire coats the blade! +{scaledSmashBuff} damage next round!" );
p.eventAttackBuff += scaledSmashBuff;
}
} );
// Enforce UI network visibility restrictions based on client connections
if ( isMultiplayer )
{
if ( (target == player && Networking.IsHost) || (target == ai && !Networking.IsHost) )
{
GameManager.Instance.TriggerChoicePopup( witchVialEvent );
}
else
{
GameManager.AddLog( $"⏳ Waiting for {p.name} to answer the network witch..." );
}
}
else
{
GameManager.Instance.TriggerChoicePopup( witchVialEvent );
}
break;
}
case 67:
{
GameManager.AddLog( "\n=== MAGIC EVENT: SPELL FEEDBACK GLITCH ===" );
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// Scale the feedback psychic sting damage linearly (+3 damage per level)
int scaledFeedbackDmg = 15 + (prestige * 3);
GameManager.AddLog( "** A violent anti-magic electromagnetic pulse scans the arena floor! Caster variables collapse! **" );
if ( player.magic >= 40 )
{
GameManager.AddLog( $"💥 {player.name} suffers spell cache feedback! -{scaledFeedbackDmg} HP and -25 Magic points!" );
CombatManager.applyDamage( ref player, scaledFeedbackDmg );
player.magic = Math.Max( 0, player.magic - 25 );
}
else
{
GameManager.AddLog( $"🛡️ {player.name}'s magic reservoir was low enough to slip beneath the scanning grid safely." );
}
if ( ai.magic >= 40 )
{
GameManager.AddLog( $"💥 {ai.name} suffers spell cache feedback! -{scaledFeedbackDmg} HP and -25 Magic points!" );
CombatManager.applyDamage( ref ai, scaledFeedbackDmg );
ai.magic = Math.Max( 0, ai.magic - 25 );
}
else
{
GameManager.AddLog( $"🛡️ {ai.name}'s magic reservoir was low enough to slip beneath the scanning grid safely." );
}
break;
}
case 68:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Code dust rolls onto Player 2 instead!
}
// =========================================================================
int scaledHealBoost = 15 + (prestige * 3);
if ( isMultiplayer )
{
GameManager.AddLog( $"\n=== MAGIC EVENT: ETHEREAL RESTORATION === " );
GameManager.AddLog( $"** A beautiful cloud of shimmering purple code dust swirls around {target.name}! Their recovery matrices glow! **" );
GameManager.AddLog( $"{target.name}'s next healing move or environmental restore will be amplified by +{scaledHealBoost} points!" );
}
else
{
GameManager.AddLog( "\n=== MAGIC EVENT: ETHEREAL RESTORATION === " );
GameManager.AddLog( $"** A beautiful cloud of shimmering purple code dust swirls around you! Your recovery matrices glow! **" );
GameManager.AddLog( $"Your next healing move or environmental restore will be amplified by +{scaledHealBoost} points!" );
}
target.eventHealingBuff += scaledHealBoost;
break;
}
case 69:
{
GameManager.AddLog( "\n=== MAGIC EVENT: CHAOTIC MANA DRAIN ===" );
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
GameManager.AddLog( "** A siphon vortex manifests in the center of the arena! It hungers for logic energy! **" );
int playerDrain = Random.Shared.Next( 15, 36 ); // 15 to 35 SP
int aiDrain = Random.Shared.Next( 15, 36 );
// Execute siphon operations
player.magic = Math.Max( 0, player.magic - playerDrain );
ai.magic = Math.Max( 0, ai.magic - aiDrain );
if ( isMultiplayer ) GameManager.AddLog( $"Vortex siphons {playerDrain} SP from {player.name} and {aiDrain} SP from {ai.name}!" );
else GameManager.AddLog( $"Vortex siphons {playerDrain} SP from you and {aiDrain} SP from the AI!" );
// 30% chance the vortex collapses and backfires the entire stolen pool into one random duelist!
if ( Random.Shared.Next( 100 ) < 30 )
{
int combinedTotalSurge = playerDrain + aiDrain;
int targetLuckyRoll = Random.Shared.Next( 2 );
if ( targetLuckyRoll == 0 )
{
if ( isMultiplayer ) GameManager.AddLog( $"💥 THE VORTEX COLLAPSES SPECTACULARLY! The combined electrical charge overflows into {player.name}'s circuits! +{combinedTotalSurge} SP!" );
else GameManager.AddLog( $"💥 THE VORTEX COLLAPSES SPECTACULARLY! The combined electrical charge overflows into YOUR circuits! +{combinedTotalSurge} SP!" );
player.magic += combinedTotalSurge;
if ( player.magic > 100 ) player.magic = 100;
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"💥 THE VORTEX COLLAPSES SPECTACULARLY! The combined electrical charge overflows into {ai.name}'s mainframe! +{combinedTotalSurge} SP!" );
else GameManager.AddLog( $"💥 THE VORTEX COLLAPSES SPECTACULARLY! The combined electrical charge overflows into the AI's mainframe! +{combinedTotalSurge} SP!" );
ai.magic += combinedTotalSurge;
if ( ai.magic > 100 ) ai.magic = 100;
}
}
break;
}
case 70:
{
GameManager.AddLog( "\n=== ARMOR EVENT: IRON METEORITE OVERLAY ===" );
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
int maxPlayerDefense = player.maxDefense;
int maxAIDefense = ai.maxDefense;
// Scale the flat reinforcement points smoothly (+4 armor per prestige)
int scaledReinforce = 15 + (prestige * 4);
GameManager.AddLog( $"** A shower of metallic iron slag falls from above, sticking to both duelists' armor hulls! +{scaledReinforce} Defense! **" );
player.defense += scaledReinforce;
ai.defense += scaledReinforce;
// Dynamic Cap Safety: Clamps securely to your true ceiling modifiers instead of hardcoded loops
if ( player.defense > maxPlayerDefense ) player.defense = maxPlayerDefense;
if ( ai.defense > maxAIDefense ) ai.defense = maxAIDefense;
GameManager.AddLog( $"{player.name} Armor: {player.defense} | {ai.name} Armor: {ai.defense}" );
break;
}
case 71:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Scrapheap clamps onto Player 2 instead!
}
int maxTargetDefense = target.maxDefense;
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== ARMOR EVENT: THE SCRAPHEAP ANCHOR ===" );
GameManager.AddLog( $"** A magnetic clamp anchors {target.name} down into an old crate of titanium plating plates! **" );
GameManager.AddLog( "⚠️ AWAITING HARDWARE EXTRACTION OVERRIDE CHOICE..." );
}
else
{
GameManager.AddLog( "\n=== ARMOR EVENT: THE SCRAPHEAP ANCHOR ===" );
GameManager.AddLog( "** A magnetic clamp anchors you down into an old crate of titanium plating plates! **" );
GameManager.AddLog( "⚠️ AWAITING HARDWARE EXTRACTION OVERRIDE CHOICE..." );
}
// Calculate scaled reward/risk parameters (+3 to +5 per prestige tier)
int scaledPlateArmor = 25 + (prestige * 5);
int scaledSpikeBuff = 15 + (prestige * 3);
int scaledWeightPenalty = 10 + (prestige * 2);
var p = target;
var scrapEvent = new ChoiceEvent
{
Title = "📦 MAGNETIC SCRAPHEAP MANIFESTATION",
PromptText = isMultiplayer
? $"{p.name}'s hardware shell has anchored into a pile of encrypted titanium military wreckage fragments. Select your engineering deployment choice:"
: "Your hardware shell has anchored into a pile of encrypted titanium military wreckage fragments. Select your engineering deployment choice:",
};
// --- BUTTON 1: BOLT PLATES ON ---
scrapEvent.Options.Add( new EventOption
{
ButtonText = $"🛡️ BOLT PLATES ON (+{scaledPlateArmor} ARMOR, -{scaledWeightPenalty} ATK NEXT ROUND)",
ActionToExecute = () =>
{
if ( isMultiplayer ) GameManager.AddLog( $"{p.name} reinforces their plating with scrap chunks! Armor boosted by +{scaledPlateArmor}!" );
else GameManager.AddLog( $"You reinforce your plating with scrap chunks! Armor boosted by +{scaledPlateArmor}!" );
p.defense += scaledPlateArmor;
if ( p.defense > maxTargetDefense ) p.defense = maxTargetDefense;
p.eventAttackBuff -= scaledWeightPenalty;
GameManager.AddLog( $"{p.name} Armor: {p.defense} | Next attack suffers weight drag penalty!" );
}
} );
// --- BUTTON 2: FORGE SPIKES ---
scrapEvent.Options.Add( new EventOption
{
ButtonText = $"⚔️ FORGE KINETIC SPIKES (+{scaledSpikeBuff} ATK NEXT TURN)",
ActionToExecute = () =>
{
if ( isMultiplayer ) GameManager.AddLog( $"{p.name} shapes the metal into razor sharp jagged shards on their gloves! Their next strike gains +{scaledSpikeBuff} cutting power!" );
else GameManager.AddLog( $"You shape the metal into razor sharp jagged shards on your gloves! Your next strike gains +{scaledSpikeBuff} cutting power!" );
p.eventAttackBuff += scaledSpikeBuff;
}
} );
if ( isMultiplayer )
{
if ( (target == player && Networking.IsHost) || (target == ai && !Networking.IsHost) )
{
GameManager.Instance.TriggerChoicePopup( scrapEvent );
}
else
{
GameManager.AddLog( $"⏳ Waiting for {p.name} to configure their scrapheap deployment choice..." );
}
}
else
{
GameManager.Instance.TriggerChoicePopup( scrapEvent );
}
break;
}
case 72:
{
GameManager.AddLog( "\n=== ARMOR EVENT: CORROSIVE OXIDATION CLOUD ===" );
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// Scale the acid armor corrosion strip linearly (+3 protection points stripped per prestige)
int scaledRustStrip = 10 + (prestige * 3);
GameManager.AddLog( "** A green cloud of highly corrosive airborne chemical cleaner floods the floor channels! **" );
GameManager.AddLog( "Hulls sizzle! Both combatants suffer structural defense compromises!" );
player.defense = Math.Max( 0, player.defense - scaledRustStrip );
ai.defense = Math.Max( 0, ai.defense - scaledRustStrip );
GameManager.AddLog( $"{player.name} Armor: {player.defense} | {ai.name} Armor: {ai.defense}" );
break;
}
case 73:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Energy projector drops on Player 2 instead!
}
// =========================================================================
int scaledBarrierBonus = 15 + (prestige * 4);
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== ARMOR EVENT: FORTIFIED FORCEFIELD ===" );
GameManager.AddLog( $"** A drone glides in and drops an energy shield projector directly on {target.name}'s shoulder pad loop! **" );
GameManager.AddLog( $"{target.name}'s next physical round defense calculation is reinforced with +{scaledBarrierBonus} points!" );
}
else
{
GameManager.AddLog( "\n=== ARMOR EVENT: FORTIFIED FORCEFIELD ===" );
GameManager.AddLog( $"** A drone glides in and drops an energy shield projector directly on your shoulder pad loop! **" );
GameManager.AddLog( $"Your next physical round defense calculation is reinforced with +{scaledBarrierBonus} points!" );
}
target.eventAttackBuff += scaledBarrierBonus;
break;
}
case 74:
{
GameManager.AddLog( "\n=== ARMOR EVENT: NANOBOT RE-PLATING RACE ===" );
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
int maxPlayerDefense = player.maxDefense;
int maxAIDefense = ai.maxDefense;
GameManager.AddLog( "** A batch of rogue hardware repair nanobots floods the arena circuitry! It's a quick-witted construction race! **" );
int playerCompileRoll = Random.Shared.Next( 1, 101 );
int aiCompileRoll = Random.Shared.Next( 1, 101 );
int scaledWinnerArmorReward = 25 + (prestige * 5);
int scaledLoserArmorReward = 10 + (prestige * 2);
if ( playerCompileRoll > aiCompileRoll )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"** SUCCESS! {player.name}'s logic terminals compiled code faster! Capturing the primary bot swarm! +{scaledWinnerArmorReward} Armor! **" );
GameManager.AddLog( $"{ai.name} receives residual fragments: +{scaledLoserArmorReward} Armor." );
}
else
{
GameManager.AddLog( $"** SUCCESS! Your logic terminals compiled code faster! You capture the primary bot swarm! +{scaledWinnerArmorReward} Armor! **" );
GameManager.AddLog( $"AI receives residual fragments: +{scaledLoserArmorReward} Armor." );
}
player.defense += scaledWinnerArmorReward;
ai.defense += scaledLoserArmorReward;
}
else if ( aiCompileRoll > playerCompileRoll )
{
if ( isMultiplayer )
{
GameManager.AddLog( $"** DEFICIT! {ai.name}'s calculation loops outpaced {player.name} and locked down the prime grid vector! +{scaledWinnerArmorReward} Armor! **" );
GameManager.AddLog( $"{player.name} receives residual fragments: +{scaledLoserArmorReward} Armor." );
}
else
{
GameManager.AddLog( $"** DEFICIT! The AI's calculation loops outpaced yours and locked down the prime grid vector! AI gains +{scaledWinnerArmorReward} Armor! **" );
GameManager.AddLog( $"You receive residual fragments: +{scaledLoserArmorReward} Armor." );
}
ai.defense += scaledWinnerArmorReward;
player.defense += scaledLoserArmorReward;
}
else
{
GameManager.AddLog( $"** TIE DATA PACKET SECTOR! The nanobots divide perfectly evenly down the center lines! Both gain +{scaledLoserArmorReward} Armor! **" );
player.defense += scaledLoserArmorReward;
ai.defense += scaledLoserArmorReward;
}
if ( player.defense > maxPlayerDefense ) player.defense = maxPlayerDefense;
if ( ai.defense > maxAIDefense ) ai.defense = maxAIDefense;
GameManager.AddLog( $"{player.name} Armor: {player.defense} | {ai.name} Armor: {ai.defense}" );
break;
}
case 75:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Shunt demands a health sacrifice from Player 2 instead!
}
// =========================================================================
int hpSacrifice = 15 + (prestige * 2);
int manaGain = 40 + (prestige * 5);
GameManager.AddLog( "\n=== MAGIC EVENT: CORE OVERCLOCK SHUNT ===" );
GameManager.AddLog( "** The arena grid demands a sacrifice to open its logic gate! **" );
GameManager.AddLog( $"** {target.name}'s core processors shunt {hpSacrifice} physical HP directly into raw energy! Gaining +{manaGain} SP! **" );
CombatManager.applyDamage( ref target, hpSacrifice );
target.magic += manaGain;
if ( target.magic > 100 ) target.magic = 100;
GameManager.AddLog( $"{target.name} HP: {target.hp} | SP: {target.magic}/100" );
break;
}
case 76:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
GameManager.AddLog( "\n=== MAGIC EVENT: THE DESYNC INVERSION ===" );
GameManager.AddLog( "** A catastrophic time-dilation desync flips the digital landscape upside down! **" );
int tempPlayerMagic = player.magic;
player.magic = ai.magic;
ai.magic = tempPlayerMagic;
if ( isMultiplayer ) GameManager.AddLog( $"⚡ Resource values swapped! {player.name}'s SP is now {player.magic}/100 | {ai.name}'s SP is now {ai.magic}/100!" );
else GameManager.AddLog( $"⚡ Resource values swapped! Your SP is now {player.magic}/100 | AI's SP is now {ai.magic}/100!" );
if ( player.magic >= 75 )
{
if ( isMultiplayer ) GameManager.AddLog( $"🔥 {player.name}'s matrix variance bounds have suddenly expanded!" );
else GameManager.AddLog( "🔥 Your matrix variance bounds have suddenly expanded!" );
}
if ( ai.magic >= 75 )
{
if ( isMultiplayer ) GameManager.AddLog( $"🔥 {ai.name}'s matrix variance bounds have suddenly expanded!" );
else GameManager.AddLog( "🔥 The AI Overlord is radiating critical magic energy!" );
}
break;
}
case 77:
{
GameManager.AddLog( "\n=== MAGIC EVENT: ANTI-VIRUS SANITIZATION ===" );
GameManager.AddLog( "** A global firewall sweep wipes all active memory caches from the board! **" );
player.cursed = false;
ai.cursed = false;
player.magic /= 2;
ai.magic /= 2;
GameManager.AddLog( "All status curses purged. Volatile magic pools cut by 50% to prevent database corruption." );
GameManager.AddLog( $"{player.name} SP: {player.magic}/100 | {ai.name} SP: {ai.magic}/100" );
break;
}
case 78:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Code corruption fragment leaks onto Player 2 instead!
}
int maxTargetHp = target.maxHp;
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== MAGIC EVENT: SOURCE CODE CORRUPTION ===" );
GameManager.AddLog( $"** A corrupted source code packet leaks onto {target.name}'s terminal... **" );
GameManager.AddLog( "⚠️ AWAITING MALWARE INTEGRATION CHOICES..." );
}
else
{
GameManager.AddLog( "\n=== MAGIC EVENT: SOURCE CODE CORRUPTION ===" );
GameManager.AddLog( "** A corrupted source code packet leaks onto your terminal... **" );
GameManager.AddLog( "⚠️ AWAITING MALWARE INTEGRATION CHOICES..." );
}
int scaledSpikeAtk = 25 + (prestige * 4);
int scaledBurnDmg = 20 + (prestige * 3);
var p = target;
var corruptEvent = new ChoiceEvent
{
Title = "👾 MALWARE SOURCE CODE DETECTED",
PromptText = isMultiplayer
? $"A fragment of forbidden developer testing code has opened near {p.name}. Will you load it or purge it?"
: "A fragment of forbidden developer testing code has opened. Will you load it into your magic spell cache or delete it for a recovery flush?",
};
// --- BUTTON 1: INJECT PROTOCOL ---
corruptEvent.Options.Add( new EventOption
{
ButtonText = $"⚡ INJECT PROTOCOL (+{scaledSpikeAtk} ATK SPELL BUFF, COMPROMISE OWN RECOVERY)",
ActionToExecute = () =>
{
if ( isMultiplayer ) GameManager.AddLog( $"Forbidden data stream loaded! {p.name}'s next magic spell attack gains +{scaledSpikeAtk} damage, but internal repairs are broken!" );
else GameManager.AddLog( $"Forbidden data stream loaded! Your next magic spell attack gains +{scaledSpikeAtk} damage, but your internal repairs are broken!" );
p.eventAttackBuff += scaledSpikeAtk;
p.eventHealingBuff -= 99;
}
} );
// --- BUTTON 2: FORMAT CACHE ---
corruptEvent.Options.Add( new EventOption
{
ButtonText = "🧹 PURGE CACHE (RESTORE HEALTH & MANA safely)",
ActionToExecute = () =>
{
int healthRestore = 15 + (prestige * 3);
if ( isMultiplayer ) GameManager.AddLog( $"{p.name} safely isolates and scrubs the file! System recovery routines execute smoothly. +{healthRestore} HP and +20 SP!" );
else GameManager.AddLog( $"You safely isolate and scrub the file! System recovery routines execute smoothly. +{healthRestore} HP and +20 SP!" );
p.hp += healthRestore;
p.magic += 20;
if ( p.hp > maxTargetHp ) p.hp = maxTargetHp;
if ( p.magic > 100 ) p.magic = 100;
}
} );
if ( isMultiplayer )
{
if ( (target == player && Networking.IsHost) || (target == ai && !Networking.IsHost) )
{
GameManager.Instance.TriggerChoicePopup( corruptEvent );
}
else
{
GameManager.AddLog( $"⏳ Waiting for {p.name} to answer the malware file choice..." );
}
}
else
{
GameManager.Instance.TriggerChoicePopup( corruptEvent );
}
break;
}
case 79:
{
GameManager.AddLog( "\n=== MAGIC EVENT: THE INFINITE SPARK ===" );
GameManager.AddLog( "** The matrix loops infinitely for a single processing cycle! **" );
GameManager.AddLog( "✨ Every single active weapon enchantment triggers its positive logic instantly! ✨" );
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
int sparkGift = 15 + (prestige * 3);
player.magic = Math.Min( 100, player.magic + sparkGift );
ai.magic = Math.Min( 100, ai.magic + sparkGift );
GameManager.AddLog( $"Spark surge grants +{sparkGift} magic points to both duelists!" );
break;
}
case 80:
{
GameManager.AddLog( "\n=== ARMOR EVENT: SINGULARITY MAGNETIC EMP ===" );
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int playerStrip = player.defense / 2;
int aiStrip = ai.defense / 2;
player.defense -= playerStrip;
ai.defense -= aiStrip;
if ( isMultiplayer ) GameManager.AddLog( $"The pulse shears off metal plating! Stripped {playerStrip} Armor from {player.name} and {aiStrip} Armor from {ai.name}!" );
else GameManager.AddLog( $"The pulse shears off metal plating! Stripped {playerStrip} Armor from you and {aiStrip} Armor from the AI!" );
GameManager.AddLog( $"{player.name} Armor: {player.defense} | {ai.name} Armor: {ai.defense}" );
break;
}
case 81:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Graphite spikes erupt on Player 2 instead!
}
// =========================================================================
// Scale thorn feedback damage linearly with prestige tiers
int spikeThornDmg = 12 + (prestige * 3);
if ( isMultiplayer )
{
GameManager.AddLog( $"\n=== ARMOR EVENT: REACTIONARY SPIKE PLATING ===" );
GameManager.AddLog( $"** Spikes of polarized conducting graphite break out across {target.name}'s armor frame! **" );
GameManager.AddLog( $"As long as their blue armor defense bar stays above 0, the next time they take a hit, the attacker takes {spikeThornDmg} spike damage!" );
}
else
{
GameManager.AddLog( "\n=== ARMOR EVENT: REACTIONARY SPIKE PLATING ===" );
GameManager.AddLog( $"** Spikes of polarized conducting graphite break out across your armor frame! **" );
GameManager.AddLog( $"As long as your blue armor defense bar stays above 0, the next time you take a hit, the attacker takes {spikeThornDmg} spike damage!" );
}
target.eventAttackBuff += spikeThornDmg;
break;
}
case 82:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // The recycling window affects Player 2 instead!
}
int maxTargetDefense = target.maxDefense;
// =========================================================================
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== ARMOR EVENT: RECYCLING REDIRECT ===" );
GameManager.AddLog( $"** {target.name}'s defensive processors detect a system vulnerability window... **" );
GameManager.AddLog( "⚠️ AWAITING DEFENSIVE REDIRECTION CHOICE..." );
}
else
{
GameManager.AddLog( "\n=== ARMOR EVENT: RECYCLING REDIRECT ===" );
GameManager.AddLog( "** Your defensive processors detect a system vulnerability window... **" );
GameManager.AddLog( "⚠️ AWAITING DEFENSIVE REDIRECTION CHOICE..." );
}
var p = target;
var recycleEvent = new ChoiceEvent
{
Title = "🎛️ SHIELD OVERRIDE REDIRECTION MATRIX",
PromptText = isMultiplayer
? $"Will {p.name} dismantle half their active blue armor plating to completely restore their magic circuits, or leave it intact?"
: "Will you dismantle half your active blue armor plating to completely restore your magic circuits, or leave it intact?",
};
// --- BUTTON 1: RECYCLE SHIELD ---
recycleEvent.Options.Add( new EventOption
{
ButtonText = "🔋 SACRIFICE HALF ARMOR FOR FULL MANA (OVERCLOCK STRAT)",
ActionToExecute = () =>
{
if ( p.defense > 0 )
{
int lostArmor = p.defense / 2;
p.defense -= lostArmor;
p.magic = 100; // Complete instant mana reload!
if ( isMultiplayer ) GameManager.AddLog( $"{p.name} melts down {lostArmor} armor plates to ignite their power cells! Magic fully restored to 100 SP! Time to overclock!" );
else GameManager.AddLog( $"You melt down {lostArmor} armor plates to ignite your power cells! Magic fully restored to 100 SP! Time to overclock!" );
}
else
{
if ( isMultiplayer ) GameManager.AddLog( $"{p.name} has 0 active armor plates to recycle! The redirect matrix crashes out." );
else GameManager.AddLog( "You have 0 active armor plates to recycle! The redirect matrix crashes out." );
}
}
} );
// --- BUTTON 2: FORTIFY HULL ---
recycleEvent.Options.Add( new EventOption
{
ButtonText = "🛡️ OVERCHARGE CERAMIC CORE (+30 GUARANTEED ARMOR)",
ActionToExecute = () =>
{
int armorGain = 30 + (prestige * 5);
if ( isMultiplayer ) GameManager.AddLog( $"{p.name} pushes backup lines to the shield capacitors! +{armorGain} blue armor padding established safely!" );
else GameManager.AddLog( $"You push backup lines to the shield capacitors! +{armorGain} blue armor padding established safely!" );
p.defense += armorGain;
if ( p.defense > maxTargetDefense ) p.defense = maxTargetDefense;
}
} );
if ( isMultiplayer )
{
if ( (target == player && Networking.IsHost) || (target == ai && !Networking.IsHost) )
{
GameManager.Instance.TriggerChoicePopup( recycleEvent );
}
else
{
GameManager.AddLog( $"⏳ Waiting for {p.name} to execute their shield override choices..." );
}
}
else
{
GameManager.Instance.TriggerChoicePopup( recycleEvent );
}
break;
}
case 83:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
// =========================================================================
// 🎯 DYNAMIC MULTIPLAYER TARGET SELECTOR
// =========================================================================
ref Player target = ref player;
if ( isMultiplayer && Random.Shared.Next( 2 ) == 0 )
{
target = ref ai; // Cargo drops plasma sludge on Player 2 instead!
}
int maxTargetDefense = target.maxDefense;
// =========================================================================
// Grants an enormous shield boost but forces your next move to take a small random roll penalty
int megaShieldBoost = 40 + (prestige * 8);
if ( isMultiplayer )
{
GameManager.AddLog( "\n=== ARMOR EVENT: EXTRUDED PLASMA SHIELD ===" );
GameManager.AddLog( $"** An emergency cargo drop floods {target.name}'s systems with heavy liquid plasma defense foam! **" );
GameManager.AddLog( $"{target.name}'s blue armor bar expands significantly by +{megaShieldBoost}! However, the cooling weight slows them down slightly." );
}
else
{
GameManager.AddLog( "\n=== ARMOR EVENT: EXTRUDED PLASMA SHIELD ===" );
GameManager.AddLog( $"** An emergency cargo drop floods your systems with heavy liquid plasma defense foam! **" );
GameManager.AddLog( $"Your blue armor bar expands significantly by +{megaShieldBoost}! However, the cooling weight slows you down slightly." );
}
target.defense += megaShieldBoost;
if ( target.defense > maxTargetDefense ) target.defense = maxTargetDefense;
target.eventAttackBuff -= 5;
GameManager.AddLog( $"{target.name} Armor maxed to: {target.defense}." );
break;
}
case 84:
{
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = isMultiplayer ? 0 : (manager != null ? manager.CurrentPrestige : 0);
GameManager.AddLog( "\n=== ARMOR EVENT: CRITICAL SHIELD SYNCHRONICITY ===" );
GameManager.AddLog( "** The engine synchronizes both fighters' shields to the highest active baseline! **" );
int highestArmorValue = Math.Max( player.defense, ai.defense );
if ( highestArmorValue <= 10 )
{
highestArmorValue = 25 + (prestige * 4);
GameManager.AddLog( $"Both defensive fields were completely broken. Grid establishes an emergency buffer of {highestArmorValue} armor for everyone!" );
}
else
{
GameManager.AddLog( $"Data stream equalized! Both duelists' armor hulls are instantly boosted to the maximum active value of {highestArmorValue}!" );
}
player.defense = highestArmorValue;
ai.defense = highestArmorValue;
int maxP = player.maxDefense;
int maxA = ai.maxDefense;
if ( player.defense > maxP ) player.defense = maxP;
if ( ai.defense > maxA ) ai.defense = maxA;
GameManager.AddLog( $"{player.name} Armor: {player.defense} | {ai.name} Armor: {ai.defense}" );
break;
}
case 85:
{
// 🔮 ANIMATION UPDATE: Banners the holy celestial descent in a slow pulsing golden strobe!
GameManager.AddEventLog( "\n=== 🕊️ CELESTIAL BLESSING COVENANT ===" );
GameManager.AddEventLog( "A blinding, radiant golden halo descends from the mainframe skies." );
GameManager.AddEventLog( "\"ACCEPT THE LIGHT AND RE-RESTORE YOUR ARCHITECTURE.. OR DENY THE HEAVENS AND DRAIN YOUR MAGIC!\" a holy echo thunders.\n" );
GameManager.AddSystemLog( "⚠️ AWAITING DIVINE NETWORK HANDSHAKE SIGNATURES..." );
// 1. Fetch current scene progression data securely upfront
var manager = Sandbox.Game.ActiveScene.Get<GameManager>();
bool isMultiplayer = manager != null && manager.CurrentMode == GameManager.PlayMode.Multiplayer;
int prestige = manager != null ? manager.CurrentPrestige : 0;
int maxPlayerHp = player.maxHp;
int maxAIHp = ai.maxHp;
// Calculate scaled prestige modifications (Flattened to baseline for competitive multiplayer matches)
int scaledHeavenlyAtk = 25 + ((isMultiplayer ? 0 : prestige) * 4); // Massive Heavenly Power Boost
int scaledHeavenlyHeal = 40 + ((isMultiplayer ? 0 : prestige) * 6); // Massive Heavenly Health Restore
int scaledHolyRebuke = 15 + ((isMultiplayer ? 0 : prestige) * 2); // Direct Smite Damage
// Local stack pointers to satisfy reference parameter passing
var p = player;
var a = ai;
// =========================================================================
// 🌐 LIVE MULTIPLAYER SIMULTANEOUS CACHE REGISTERS
// =========================================================================
int p1CovenantChoice = 0;
int p2CovenantChoice = 0;
bool isCovenantResolved = false;
void ResolveHeavenlyBlessing( int choicePlayer, int choiceAI )
{
if ( isMultiplayer )
{
GameManager.AddPlayerLog( $"📜 {p.name} chooses to {(choicePlayer == 1 ? "ACCEPT" : "DENY")} the covenant." );
GameManager.AddAILog( $"📜 {a.name} chooses to {(choiceAI == 1 ? "ACCEPT" : "DENY")} the covenant!\n" );
}
else
{
GameManager.AddPlayerLog( $"You choose to {(choicePlayer == 1 ? "ACCEPT" : "DENY")} the covenant." );
GameManager.AddAILog( $"AI chooses to {(choiceAI == 1 ? "ACCEPT" : "DENY")} the covenant!\n" );
}
// CASE 1: BOTH ACCEPT THE HEAVENLY COVENANT
if ( choicePlayer == 1 && choiceAI == 1 )
{
int finalPlayerHeal = scaledHeavenlyHeal + p.eventHealingBuff;
int finalAIHeal = scaledHeavenlyHeal + a.eventHealingBuff;
GameManager.AddEventLog( "✨ BOTH accept the divine pact! ✨" );
if ( isMultiplayer )
{
GameManager.AddPlayerLog( $"The light fully reconstructs {p.name}'s parameters! (+{scaledHeavenlyAtk} ATK next turn, restored +{finalPlayerHeal} HP to their core grid!)" );
GameManager.AddAILog( $"The light fully reconstructs {a.name}'s parameters! (+{scaledHeavenlyAtk} ATK next turn, restored +{finalAIHeal} HP to their core grid!)" );
}
else
{
GameManager.AddPlayerLog( $"The light fully reconstructs your parameters! (+{scaledHeavenlyAtk} ATK next turn, restored +{finalPlayerHeal} HP to your core grid!)" );
GameManager.AddAILog( $"The light fully reconstructs the AI parameters! (+{scaledHeavenlyAtk} ATK next turn, restored +{finalAIHeal} HP to the boss grid!)" );
}
p.eventAttackBuff += scaledHeavenlyAtk;
p.hp += finalPlayerHeal;
a.eventAttackBuff += scaledHeavenlyAtk;
a.hp += finalAIHeal;
p.cursed = false;
a.cursed = false;
if ( p.hp > maxPlayerHp ) p.hp = maxPlayerHp;
if ( a.hp > maxAIHp ) a.hp = maxAIHp;
p.eventHealingBuff = 0;
a.eventHealingBuff = 0;
return;
}
// CASE 2: PLAYER 1 ACCEPTS, PLAYER 2 DENIES THE COVENANT
if ( choicePlayer == 1 && choiceAI == 2 )
{
int finalPlayerHeal = scaledHeavenlyHeal + p.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddEventLog( $"✨ {p.name} accepts the covenant, {a.name} denies the light! ✨" );
else GameManager.AddEventLog( "✨ You accept the covenant, AI denies the light! ✨" );
if ( isMultiplayer ) GameManager.AddPlayerLog( $"Heavenly energy hyper-charges {p.name}'s weapon slots! (+{scaledHeavenlyAtk} ATK next turn, recovered +{finalPlayerHeal} HP! Cleaned status effects!)" );
else GameManager.AddPlayerLog( $"Heavenly energy hyper-charges your weapon slots! (+{scaledHeavenlyAtk} ATK next turn, recovered +{finalPlayerHeal} HP! Cleaned status effects!)" );
p.eventAttackBuff += scaledHeavenlyAtk;
p.hp += finalPlayerHeal;
p.cursed = false;
if ( isMultiplayer ) GameManager.AddAILog( $"⚡ THE HEAVENS REBUKE {a.name.ToUpper()}! Its active magic registers have been completely DRAINED to 0 SP!" );
else GameManager.AddAILog( "⚡ THE HEAVENS REBUKE THE AI! Its active magic registers have been completely DRAINED to 0 SP!" );
a.magic = 0;
if ( Random.Shared.Next( 1, 101 ) < 11 )
{
GameManager.AddAILog( $"💥 HOLY REBUKE SMITE! {a.name} takes -{scaledHolyRebuke} structural damage!" );
CombatManager.applyDamage( ref a, scaledHolyRebuke );
}
if ( p.hp > maxPlayerHp ) p.hp = maxPlayerHp;
p.eventHealingBuff = 0;
return;
}
// CASE 3: PLAYER 1 DENIES, PLAYER 2 ACCEPTS THE COVENANT
if ( choicePlayer == 2 && choiceAI == 1 )
{
int finalAIHeal = scaledHeavenlyHeal + a.eventHealingBuff;
if ( isMultiplayer ) GameManager.AddEventLog( $"✨ {a.name} accepts the covenant, {p.name} denies the light! ✨" );
else GameManager.AddEventLog( "✨ AI accepts the covenant, YOU deny the light! ✨" );
if ( isMultiplayer ) GameManager.AddAILog( $"Heavenly energy hyper-charges {a.name}'s weapon slots! (+{scaledHeavenlyAtk} ATK next turn, recovered +{finalAIHeal} HP! Cleaned status effects!)" );
else GameManager.AddAILog( $"Heavenly energy hyper-charges the AI's weapon slots! (+{scaledHeavenlyAtk} ATK next turn, recovered +{finalAIHeal} HP! Cleaned status effects!)" );
a.eventAttackBuff += scaledHeavenlyAtk;
a.hp += finalAIHeal;
a.cursed = false;
if ( isMultiplayer ) GameManager.AddPlayerLog( $"⚡ THE HEAVENS REBUKE {p.name.ToUpper()}'S IMPIETY! Their active magic registers have been completely DRAINED to 0 SP!" );
else GameManager.AddPlayerLog( "⚡ THE HEAVENS REBUKE YOUR IMPIETY! Your active magic registers have been completely DRAINED to 0 SP!" );
p.magic = 0;
if ( Random.Shared.Next( 1, 101 ) < 11 )
{
if ( isMultiplayer ) GameManager.AddPlayerLog( $"💥 HOLY REBUKE SMITE! {p.name}'s framework suffers -{scaledHolyRebuke} structural damage!" );
else GameManager.AddPlayerLog( $"💥 HOLY REBUKE SMITE! Your framework suffers -{scaledHolyRebuke} structural damage!" );
CombatManager.applyDamage( ref p, scaledHolyRebuke );
}
if ( a.hp > maxAIHp ) a.hp = maxAIHp;
a.eventHealingBuff = 0;
return;
}
// CASE 4: BOTH DENY THE DIVINE HANDSHAKE
GameManager.AddEventLog( "❌ Both deny the covenant! The clouds darken... ❌" );
if ( isMultiplayer )
{
GameManager.AddPlayerLog( $"{p.name}'s magic cache is completely emptied! (-100% SP)" );
GameManager.AddAILog( $"{a.name}'s magic cache is completely emptied! (-100% SP)" );
}
else
{
GameManager.AddPlayerLog( "Your magic cache is completely emptied! (-100% SP)" );
GameManager.AddAILog( "AI's magic cache is completely emptied! (-100% SP)" );
}
p.magic = 0;
a.magic = 0;
GameManager.AddSystemLog( $"{p.name} | HP: {p.hp} | Magic: {p.magic}" );
GameManager.AddSystemLog( $"{a.name} | HP: {a.hp} | Magic: {a.magic}" );
}
if ( isMultiplayer )
{
var multiplayerBlessingEvent = new ChoiceEvent
{
Title = "🕊️ CELESTIAL PROTOCOL BLESSING",
PromptText = "A radiant golden aura has overridden your network stack. A heavenly algorithm offering absolute purification requests an architecture covenant signature. If denied, your magic allocation pipeline will be force-severed.",
};
Action<int, bool> handleNetworkChoice = ( choiceIndex, isHost ) =>
{
if ( isHost ) p1CovenantChoice = choiceIndex;
else p2CovenantChoice = choiceIndex;
if ( p1CovenantChoice > 0 && p2CovenantChoice > 0 && !isCovenantResolved )
{
isCovenantResolved = true;
GameManager.AddLog( $"\n🕊️ [DIVINE HANDSHAKE OUTCOME] Symmetrical celestial parameters locked!" );
ResolveHeavenlyBlessing( p1CovenantChoice, p2CovenantChoice );
if ( manager != null ) manager.IsChoiceEventActive = false;
}
else
{
string selectorName = isHost ? p.name : a.name;
GameManager.AddLog( $"📡 [NET] {selectorName} locked their celestial covenant choice vector!" );
}
};
multiplayerBlessingEvent.Options.Add( new EventOption { ButtonText = "🕊️ ACCEPT DIVINE COVENANT (BOOST DATA & CURE)", ActionToExecute = () => handleNetworkChoice( 1, Networking.IsHost ) } );
multiplayerBlessingEvent.Options.Add( new EventOption { ButtonText = "⚡ REJECT THE HEAVENS (PROTECT SP CACHE)", ActionToExecute = () => handleNetworkChoice( 2, Networking.IsHost ) } );
GameManager.Instance.TriggerChoicePopup( multiplayerBlessingEvent );
}
else
{
// 🤖 SINGLE PLAYER MODE: Your exact original un-edited career rules
int secretAIChoice = Random.Shared.Next( 1, 3 );
var blessingEvent = new ChoiceEvent
{
Title = "🕊️ CELESTIAL PROTOCOL BLESSING",
PromptText = "A radiant golden aura has overridden your network stack. A heavenly algorithm offering absolute purification requests an architecture covenant signature in exchange for massive data restoration. If denied, your magic allocation pipeline will be force-severed. Execute handshake?",
};
blessingEvent.Options.Add( new EventOption
{
ButtonText = "🕊️ ACCEPT DIVINE COVENANT (BOOST DATA & CURE)",
ActionToExecute = () => { ResolveHeavenlyBlessing( 1, secretAIChoice ); }
} );
blessingEvent.Options.Add( new EventOption
{
ButtonText = "⚡ REJECT THE HEAVENS (PROTECT SP CACHE)",
ActionToExecute = () => { ResolveHeavenlyBlessing( 2, secretAIChoice ); }
} );
GameManager.Instance.TriggerChoicePopup( blessingEvent );
}
break;
}
}
}
}