using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MemeMadness.Cards;
using MemeMadness.Story;
using MemeMadness.Util;
using Microsoft.CodeAnalysis;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using ModsPlus;
using Photon.Pun;
using RarityLib.Utils;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MemeMadness")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("MemeMadness")]
[assembly: AssemblyTitle("MemeMadness")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MemeMadness
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.christhemelton.rounds.mememadness", "Meme Madness", "1.0.1")]
[BepInProcess("Rounds.exe")]
public class MemeMadness : BaseUnityPlugin
{
public const string ModId = "com.christhemelton.rounds.mememadness";
public const string ModName = "Meme Madness";
public const string Version = "1.0.1";
public const string ModInitials = "MEME";
internal static ManualLogSource Log;
public static MemeMadness Instance { get; private set; }
private void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
new Harmony("com.christhemelton.rounds.mememadness").PatchAll();
}
private void Start()
{
Unbound.RegisterCredits("Meme Madness", new string[2] { "ChrisTheMelton", "Claude" }, "", "");
MadCards.RegisterAll();
StoryNet.Init();
UndieHooks.Init();
Log.LogInfo((object)"Meme Madness 1.0.1 loaded.");
}
}
}
namespace MemeMadness.Util
{
public static class Assets
{
private static class Wav
{
public static AudioClip ToClip(string name, byte[] b)
{
int num = 1;
int num2 = 44100;
int num3 = 16;
int i = 12;
int num4 = -1;
int num5 = 0;
int num6;
for (; i + 8 <= b.Length; i += 8 + num6 + (num6 & 1))
{
string text = Encoding.ASCII.GetString(b, i, 4);
num6 = BitConverter.ToInt32(b, i + 4);
if (text == "fmt ")
{
num = BitConverter.ToInt16(b, i + 10);
num2 = BitConverter.ToInt32(b, i + 12);
num3 = BitConverter.ToInt16(b, i + 22);
}
else if (text == "data")
{
num4 = i + 8;
num5 = Math.Min(num6, b.Length - num4);
break;
}
}
if (num4 < 0)
{
throw new InvalidDataException("no data chunk");
}
int num7 = num3 / 8;
int num8 = num5 / num7;
float[] array = new float[num8];
for (int j = 0; j < num8; j++)
{
int num9 = num4 + j * num7;
array[j] = num3 switch
{
8 => (float)(b[num9] - 128) / 128f,
16 => (float)BitConverter.ToInt16(b, num9) / 32768f,
_ => throw new InvalidDataException($"{num3}-bit wav not supported, export as 16-bit"),
};
}
AudioClip obj = AudioClip.Create(name, num8 / num, num, num2, false);
obj.SetData(array, 0);
return obj;
}
}
private static readonly Assembly Asm = typeof(Assets).Assembly;
private static readonly Dictionary<string, Sprite> Sprites = new Dictionary<string, Sprite>();
private static readonly Dictionary<string, AudioClip> Clips = new Dictionary<string, AudioClip>();
private static readonly Dictionary<string, AssetBundle> Bundles = new Dictionary<string, AssetBundle>();
private static readonly Dictionary<string, GameObject> Arts = new Dictionary<string, GameObject>();
private static readonly Dictionary<string, GifAnimation> Animations = new Dictionary<string, GifAnimation>();
private static readonly HashSet<string> Embedded = new HashSet<string>(Asm.GetManifestResourceNames());
private static readonly HashSet<string> Warned = new HashSet<string>();
public static bool Has(string fileName)
{
if (fileName != null)
{
return Embedded.Contains(fileName);
}
return false;
}
public static byte[] Bytes(string fileName)
{
if (!Has(fileName))
{
if (fileName != null && Warned.Add(fileName))
{
MemeMadness.Log.LogWarning((object)("Asset '" + fileName + "' not in /Assets yet, skipping."));
}
return null;
}
using Stream stream = Asm.GetManifestResourceStream(fileName);
MemoryStream memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
return memoryStream.ToArray();
}
public static Sprite Sprite(string fileName)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
if (Sprites.TryGetValue(fileName, out var value))
{
return value;
}
byte[] array = Bytes(fileName);
if (array == null)
{
return null;
}
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false)
{
name = fileName,
filterMode = (FilterMode)1
};
ImageConversion.LoadImage(val, array);
Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
((Object)val2).name = fileName;
return Sprites[fileName] = val2;
}
public static GameObject CardArt(string fileName)
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
if (fileName == null)
{
return null;
}
if (Arts.TryGetValue(fileName, out var value))
{
return value;
}
GifAnimation gifAnimation = (IsGif(fileName) ? Animation(fileName) : null);
Sprite val = ((gifAnimation != null) ? gifAnimation.Frames[0] : (IsGif(fileName) ? null : Sprite(fileName)));
if ((Object)(object)val == (Object)null)
{
return null;
}
GameObject val2 = new GameObject("MemeMadnessArt_" + fileName, new Type[1] { typeof(RectTransform) });
Object.DontDestroyOnLoad((Object)(object)val2);
RectTransform val3 = (RectTransform)val2.transform;
val3.anchorMin = Vector2.zero;
val3.anchorMax = Vector2.one;
Vector2 offsetMin = (val3.offsetMax = Vector2.zero);
val3.offsetMin = offsetMin;
Image obj = val2.AddComponent<Image>();
obj.sprite = val;
obj.preserveAspect = true;
((Graphic)obj).raycastTarget = false;
if (gifAnimation != null)
{
val2.AddComponent<AnimatedImage>().animationFile = fileName;
}
return Arts[fileName] = val2;
}
public static bool IsGif(string fileName)
{
return fileName?.EndsWith(".gif", StringComparison.OrdinalIgnoreCase) ?? false;
}
public static GifAnimation Animation(string fileName)
{
if (Animations.TryGetValue(fileName, out var value))
{
return value;
}
byte[] array = Bytes(fileName);
if (array == null)
{
return null;
}
try
{
GifAnimation gifAnimation = GifAnimation.Read(fileName, array);
MemeMadness.Log.LogInfo((object)$"Loaded GIF '{fileName}': {gifAnimation.Frames.Length} frames, {gifAnimation.Length:0.##}s loop");
return Animations[fileName] = gifAnimation;
}
catch (Exception ex)
{
MemeMadness.Log.LogError((object)("Could not read GIF '" + fileName + "': " + ex.Message));
return Animations[fileName] = null;
}
}
public static AudioClip Clip(string fileName)
{
if (Clips.TryGetValue(fileName, out var value))
{
return value;
}
byte[] array = Bytes(fileName);
if (array == null)
{
return null;
}
try
{
return Clips[fileName] = Wav.ToClip(fileName, array);
}
catch (Exception ex)
{
MemeMadness.Log.LogError((object)("Could not read '" + fileName + "' as a PCM .wav: " + ex.Message));
return null;
}
}
public static AssetBundle Bundle(string fileName)
{
if (Bundles.TryGetValue(fileName, out var value))
{
return value;
}
byte[] array = Bytes(fileName);
if (array != null)
{
return Bundles[fileName] = AssetBundle.LoadFromMemory(array);
}
return null;
}
}
public class GifAnimation
{
public Sprite[] Frames;
public float[] Delays;
public float Length;
public Sprite FrameAt(float t)
{
if (Frames.Length == 1 || Length <= 0f)
{
return Frames[0];
}
t %= Length;
for (int i = 0; i < Delays.Length; i++)
{
if (t < Delays[i])
{
return Frames[i];
}
t -= Delays[i];
}
return Frames[Frames.Length - 1];
}
internal static GifAnimation Read(string name, byte[] data)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
using BinaryReader binaryReader = new BinaryReader(new MemoryStream(data));
if (Encoding.ASCII.GetString(binaryReader.ReadBytes(7)) != "MMANIM1")
{
throw new InvalidDataException("not a converted GIF (was it built by tools/gif-to-anim.ps1?)");
}
int num = binaryReader.ReadInt32();
GifAnimation gifAnimation = new GifAnimation
{
Frames = (Sprite[])(object)new Sprite[num],
Delays = new float[num]
};
for (int i = 0; i < num; i++)
{
gifAnimation.Delays[i] = (float)binaryReader.ReadInt32() / 1000f;
byte[] array = binaryReader.ReadBytes(binaryReader.ReadInt32());
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false)
{
name = $"{name}#{i}",
filterMode = (FilterMode)1
};
ImageConversion.LoadImage(val, array, true);
gifAnimation.Frames[i] = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
gifAnimation.Length += gifAnimation.Delays[i];
}
return gifAnimation;
}
}
public class AnimatedImage : MonoBehaviour
{
public string animationFile;
private GifAnimation anim;
private Image image;
private float start;
private void Start()
{
image = ((Component)this).GetComponent<Image>();
anim = Assets.Animation(animationFile);
start = Time.unscaledTime;
if ((Object)(object)image == (Object)null || anim == null)
{
((Behaviour)this).enabled = false;
}
}
private void Update()
{
image.sprite = anim.FrameAt(Time.unscaledTime - start);
}
}
public static class MemeSound
{
public static void Play(string wavFile, Vector3 position, float volume = 1f)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Expected O, but got Unknown
AudioClip val = Assets.Clip(wavFile);
if (!((Object)(object)val == (Object)null))
{
GameObject val2 = new GameObject("MemeSound_" + wavFile);
val2.transform.position = position;
AudioSource obj = val2.AddComponent<AudioSource>();
obj.clip = val;
obj.spatialBlend = 0f;
obj.volume = Mathf.Clamp01(volume * Optionshandler.vol_Master * Optionshandler.vol_Sfx);
obj.Play();
Object.Destroy((Object)val2, val.length + 0.1f);
}
}
}
}
namespace MemeMadness.Story
{
public enum SC
{
None,
BeforeTaxes,
AfterTaxes,
TaxEvasion,
TaxRefund,
PayTheFine,
FleeTheCountry,
FleeToAnotherCountry,
Extradited,
BribeTheAuditor,
Prison,
ServeYourTime1,
ServeYourTime2,
ServeYourTime3,
Reformed,
PrisonBreak,
SolitaryConfinement,
StareAtTheWall,
DigATunnel,
Caught,
HitThePrisonGym,
LiftWeights,
PrisonSteroids,
YardBoss,
MindYourBusiness,
GoViral,
ReleasedForBeingFamous,
StartAPodcast,
RunForPresident,
CampaignHonestly,
RigTheElection,
Concede,
President,
PresidentialDuties,
RaiseTaxes
}
public enum Roll
{
Bribe,
Steroids,
PrisonBreak,
DigTunnel,
Campaign,
Rig
}
public struct Effect
{
public enum Kind
{
Add,
Remove,
Roll
}
public Kind What;
public int Player;
public SC Card;
public Roll RollKind;
public override string ToString()
{
if (What != Kind.Roll)
{
return $"{What} {Card} P{Player}";
}
return $"Roll {RollKind} for P{Player}";
}
public static Effect Add(int p, SC c)
{
return new Effect
{
What = Kind.Add,
Player = p,
Card = c
};
}
public static Effect Remove(int p, SC c)
{
return new Effect
{
What = Kind.Remove,
Player = p,
Card = c
};
}
public static Effect DoRoll(int p, Roll r)
{
return new Effect
{
What = Kind.Roll,
Player = p,
RollKind = r
};
}
}
public enum Pending
{
None,
AfterTaxesPick,
EvasionPick,
GymFirstPick,
WeightsLoop,
YardBossPick,
ReleasedPick,
PodcastPick,
CampaignPick,
ForcedRigPick,
PresidentPick
}
public class PlayerStory
{
public Pending Pending;
public bool Fugitive;
public bool InPrison;
public bool InSolitary;
public int Served;
public int Lifts;
public bool TunnelBanned;
public bool GymBanned;
public int RefundCountdown;
public bool RaiseTaxesPending;
public int Picks;
public PlayerStory Clone()
{
return (PlayerStory)MemberwiseClone();
}
}
public class StoryEngine
{
public readonly Dictionary<int, PlayerStory> Players = new Dictionary<int, PlayerStory>();
public bool BeforeTaxesTaken;
public const int GuaranteeEveryRounds = 3;
public int PickPhases;
public bool BtOfferedThisPhase;
public Action<string> Log = delegate
{
};
public static readonly Dictionary<Roll, float> Chance = new Dictionary<Roll, float>
{
[Roll.Bribe] = 0.1f,
[Roll.Steroids] = 0.5f,
[Roll.PrisonBreak] = 0.5f,
[Roll.DigTunnel] = 0.6f,
[Roll.Campaign] = 0.1f,
[Roll.Rig] = 0.9f
};
public static readonly SC[] PrisonCards = new SC[6]
{
SC.Prison,
SC.SolitaryConfinement,
SC.ServeYourTime1,
SC.ServeYourTime2,
SC.ServeYourTime3,
SC.StareAtTheWall
};
public void OnPickPhaseStart()
{
PickPhases++;
BtOfferedThisPhase = false;
}
public bool OffersBeforeTaxes(int p)
{
if (!BeforeTaxesTaken && PickPhases > 0 && PickPhases % 3 == 0 && !BtOfferedThisPhase)
{
return Layout(p, 1) == null;
}
return false;
}
public PlayerStory Get(int p)
{
if (!Players.TryGetValue(p, out var value))
{
value = (Players[p] = new PlayerStory());
}
return value;
}
public void ResetGame()
{
Players.Clear();
BeforeTaxesTaken = false;
PickPhases = 0;
BtOfferedThisPhase = false;
}
public void EnsurePlayers(IEnumerable<int> ids)
{
foreach (int id in ids)
{
Get(id);
}
}
public bool CanDrawNormally(SC card)
{
if (card == SC.BeforeTaxes)
{
return !BeforeTaxesTaken;
}
return true;
}
public SC[] Layout(int p, int slots)
{
if (slots <= 0)
{
return null;
}
PlayerStory playerStory = Get(p);
switch (playerStory.Pending)
{
case Pending.AfterTaxesPick:
return Fill(slots, SC.AfterTaxes, SC.TaxEvasion);
case Pending.EvasionPick:
return Fill(slots, SC.PayTheFine, SC.FleeTheCountry, SC.BribeTheAuditor);
case Pending.GymFirstPick:
return Fill(slots, SC.LiftWeights, SC.PrisonSteroids);
case Pending.WeightsLoop:
{
int num = Math.Min(Math.Max(playerStory.Lifts, 1), slots);
SC[] array = new SC[slots];
for (int i = 0; i < slots; i++)
{
array[i] = ((i < slots - num) ? SC.LiftWeights : SC.YardBoss);
}
return array;
}
case Pending.YardBossPick:
return Fill(slots, SC.MindYourBusiness, SC.GoViral);
case Pending.ReleasedPick:
return Fill(slots, SC.ReleasedForBeingFamous);
case Pending.PodcastPick:
return Fill(slots, SC.StartAPodcast, SC.RunForPresident);
case Pending.CampaignPick:
return Fill(slots, SC.CampaignHonestly, SC.RigTheElection);
case Pending.ForcedRigPick:
return Fill(slots, SC.RigTheElection);
case Pending.PresidentPick:
return Fill(slots, SC.PresidentialDuties, SC.RaiseTaxes);
default:
if (playerStory.Fugitive)
{
return Fill(slots, SC.FleeToAnotherCountry, SC.Extradited);
}
if (playerStory.InSolitary)
{
if (!playerStory.TunnelBanned)
{
return Fill(slots, SC.StareAtTheWall, SC.DigATunnel);
}
return Fill(slots, SC.StareAtTheWall);
}
if (playerStory.InPrison)
{
SC filler = ((playerStory.Served == 0) ? SC.ServeYourTime1 : ((playerStory.Served == 1) ? SC.ServeYourTime2 : SC.ServeYourTime3));
if (!playerStory.GymBanned)
{
return Fill(slots, filler, SC.HitThePrisonGym, SC.PrisonBreak);
}
return Fill(slots, filler, SC.PrisonBreak);
}
if (playerStory.RefundCountdown == 1)
{
return Fill(slots, SC.TaxRefund);
}
if (playerStory.RaiseTaxesPending)
{
return Fill(slots, SC.BeforeTaxes);
}
return null;
}
}
public static SC[] Fill(int slots, SC filler, params SC[] tail)
{
SC[] array = new SC[slots];
for (int i = 0; i < slots; i++)
{
array[i] = filler;
}
int num = Math.Max(0, slots - tail.Length);
int num2 = num;
int num3 = tail.Length - (slots - num);
while (num2 < slots)
{
array[num2] = tail[num3];
num2++;
num3++;
}
return array;
}
public List<Effect> OnPicked(int p, SC card)
{
PlayerStory playerStory = Get(p);
List<Effect> list = new List<Effect>();
playerStory.Picks++;
Log($"P{p} picked {card} (pending {playerStory.Pending})");
if (OffersBeforeTaxes(p))
{
BtOfferedThisPhase = true;
}
playerStory.Pending = Pending.None;
if (playerStory.RefundCountdown > 1 && card != SC.AfterTaxes)
{
playerStory.RefundCountdown--;
}
switch (card)
{
case SC.BeforeTaxes:
BeforeTaxesTaken = true;
playerStory.RaiseTaxesPending = false;
playerStory.Pending = Pending.AfterTaxesPick;
break;
case SC.AfterTaxes:
list.Add(Effect.Remove(p, SC.BeforeTaxes));
playerStory.RefundCountdown = 2;
break;
case SC.TaxRefund:
playerStory.RefundCountdown = 0;
break;
case SC.TaxEvasion:
playerStory.Pending = Pending.EvasionPick;
break;
case SC.PayTheFine:
list.Add(Effect.Remove(p, SC.BeforeTaxes));
break;
case SC.FleeTheCountry:
case SC.FleeToAnotherCountry:
playerStory.Fugitive = true;
break;
case SC.Extradited:
playerStory.Fugitive = false;
list.Add(Effect.Remove(p, SC.BeforeTaxes));
GoToPrison(p, playerStory, list);
break;
case SC.BribeTheAuditor:
list.Add(Effect.DoRoll(p, Roll.Bribe));
break;
case SC.ServeYourTime1:
case SC.ServeYourTime2:
case SC.ServeYourTime3:
playerStory.Served++;
if (playerStory.Served >= 3)
{
Release(p, playerStory, list);
list.Add(Effect.Add(p, SC.Reformed));
}
break;
case SC.PrisonBreak:
list.Add(Effect.DoRoll(p, Roll.PrisonBreak));
break;
case SC.StareAtTheWall:
playerStory.InSolitary = false;
list.Add(Effect.Remove(p, SC.SolitaryConfinement));
list.Add(Effect.Remove(p, SC.StareAtTheWall));
break;
case SC.DigATunnel:
list.Add(Effect.DoRoll(p, Roll.DigTunnel));
break;
case SC.HitThePrisonGym:
playerStory.Lifts = 0;
playerStory.Pending = Pending.GymFirstPick;
break;
case SC.LiftWeights:
playerStory.Lifts++;
playerStory.Pending = Pending.WeightsLoop;
break;
case SC.PrisonSteroids:
list.Add(Effect.DoRoll(p, Roll.Steroids));
break;
case SC.YardBoss:
playerStory.Lifts = 0;
playerStory.Pending = Pending.YardBossPick;
break;
case SC.MindYourBusiness:
playerStory.GymBanned = true;
break;
case SC.GoViral:
playerStory.Pending = Pending.ReleasedPick;
break;
case SC.ReleasedForBeingFamous:
Release(p, playerStory, list);
playerStory.Pending = Pending.PodcastPick;
break;
case SC.RunForPresident:
playerStory.Pending = Pending.CampaignPick;
break;
case SC.CampaignHonestly:
list.Add(Effect.DoRoll(p, Roll.Campaign));
break;
case SC.RigTheElection:
list.Add(Effect.DoRoll(p, Roll.Rig));
break;
case SC.RaiseTaxes:
foreach (int item in Players.Keys.ToList())
{
if (item != p)
{
Get(item).RaiseTaxesPending = true;
}
}
break;
}
return list;
}
public List<Effect> OnRolled(int p, Roll roll, bool good)
{
PlayerStory playerStory = Get(p);
List<Effect> list = new List<Effect>();
Log(string.Format("P{0} rolled {1}: {2}", p, roll, good ? "GOOD" : "BAD"));
switch (roll)
{
case Roll.Bribe:
if (!good)
{
list.Add(Effect.Remove(p, SC.BeforeTaxes));
GoToPrison(p, playerStory, list);
}
break;
case Roll.PrisonBreak:
if (good)
{
Release(p, playerStory, list);
playerStory.Fugitive = true;
}
else
{
GoToSolitary(p, playerStory, list);
}
break;
case Roll.DigTunnel:
if (good)
{
Release(p, playerStory, list);
playerStory.Fugitive = true;
}
else
{
playerStory.TunnelBanned = true;
list.Add(Effect.Add(p, SC.Caught));
}
break;
case Roll.Steroids:
if (good)
{
list.Add(Effect.Add(p, SC.YardBoss));
playerStory.Lifts = 0;
playerStory.Pending = Pending.YardBossPick;
}
else
{
GoToSolitary(p, playerStory, list);
}
break;
case Roll.Campaign:
if (good)
{
BecomePresident(p, playerStory, list);
break;
}
list.Add(Effect.Add(p, SC.Concede));
playerStory.Pending = Pending.ForcedRigPick;
break;
case Roll.Rig:
if (good)
{
BecomePresident(p, playerStory, list);
}
else
{
GoToPrison(p, playerStory, list);
}
break;
}
return list;
}
private static void BecomePresident(int p, PlayerStory s, List<Effect> fx)
{
fx.Add(Effect.Add(p, SC.President));
s.Pending = Pending.PresidentPick;
}
private static void GoToPrison(int p, PlayerStory s, List<Effect> fx)
{
s.InPrison = true;
s.InSolitary = false;
s.Fugitive = false;
s.Served = 0;
s.Lifts = 0;
fx.Add(Effect.Add(p, SC.Prison));
}
private static void GoToSolitary(int p, PlayerStory s, List<Effect> fx)
{
s.InSolitary = true;
s.Lifts = 0;
s.Pending = Pending.None;
fx.Add(Effect.Add(p, SC.SolitaryConfinement));
}
private static void Release(int p, PlayerStory s, List<Effect> fx)
{
s.InPrison = false;
s.InSolitary = false;
s.Served = 0;
s.Lifts = 0;
SC[] prisonCards = PrisonCards;
foreach (SC c in prisonCards)
{
fx.Add(Effect.Remove(p, c));
}
}
}
public static class UndieHooks
{
[HarmonyPatch(typeof(HealthHandler), "DoDamage")]
private static class PatchDoDamage
{
private static void Prefix(HealthHandler __instance, ref Vector2 damage, bool lethal, bool ignoreBlock)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
CharacterData data = __instance.data;
if (lethal && !(damage == Vector2.zero) && !((Object)(object)data == (Object)null) && !data.dead && data.isPlaying && !__instance.isRespawning && (!((Object)(object)data.block != (Object)null) || !(data.block.sinceBlock < 0.3f) || ignoreBlock) && !(data.health - ((Vector2)(ref damage)).magnitude >= 0f))
{
Player player = data.player;
int num = Charges(player);
if (num > 0)
{
charges[player.playerID] = num - 1;
damage = ((Vector2)(ref damage)).normalized * Mathf.Max(0f, data.health - 1f);
MemeMadness.Log.LogInfo((object)$"[Undie] P{player.playerID} survived a lethal hit ({num - 1} undie left)");
ColorFlash obj = ((Component)player).gameObject.AddComponent<ColorFlash>();
obj.SetNumberOfFlashes(3);
obj.SetDuration(0.12f);
obj.SetDelayBetweenFlashes(0.12f);
obj.SetColor(new Color(1f, 0.85f, 0.1f));
}
}
}
}
private static readonly Dictionary<int, int> charges = new Dictionary<int, int>();
public static void Init()
{
GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnPointStart);
}
private static IEnumerator OnPointStart(IGameModeHandler gm)
{
foreach (Player player in PlayerManager.instance.players)
{
Refill(player);
}
yield break;
}
public static int Total(Player p)
{
return p.data.currentCards.Sum(delegate(CardInfo c)
{
if ((Object)(object)c != (Object)null)
{
MadCard component = ((Component)c).GetComponent<MadCard>();
if (component != null)
{
return component.Undies;
}
}
return 0;
});
}
public static void Refill(Player p)
{
charges[p.playerID] = Total(p);
}
public static int Charges(Player p)
{
if (!charges.TryGetValue(p.playerID, out var value))
{
Refill(p);
return charges[p.playerID];
}
return value;
}
}
public static class JumpHooks
{
[HarmonyPatch(typeof(PlayerJump), "Jump")]
private static class PatchJump
{
[HarmonyPriority(800)]
private static bool Prefix(PlayerJump __instance, bool forceJump, float multiplier)
{
Player component = ((Component)__instance).GetComponent<Player>();
if (InPrison(component))
{
CharacterData data = __instance.data;
data.currentJumps = 0;
if (data.sinceWallGrab <= 0.1f)
{
data.sinceWallGrab = 0.11f;
}
return false;
}
if (!Levitating(component))
{
return true;
}
LevitateJump(__instance, forceJump, multiplier);
return false;
}
}
[HarmonyPatch(typeof(PlayerJump), "Update")]
private static class PatchJumpUpdate
{
private static bool Prefix(PlayerJump __instance)
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
Player component = ((Component)__instance).GetComponent<Player>();
if (!Levitating(component))
{
return true;
}
CharacterData data = __instance.data;
data.currentJumps = Mathf.Max(data.currentJumps, 99);
if (InPrison(component))
{
return false;
}
if (data.input.jumpWasPressed)
{
__instance.Jump(false, 1f);
}
if (data.input.jumpIsPressed && data.sinceJump < 0.2f)
{
data.playerVel.AddForce(Vector2.down * TimeHandler.deltaTime * 2f * data.stats.jump * data.playerVel.mass * (1f - __instance.stats.GetSlow()) * __instance.upForce, (ForceMode2D)0);
}
return false;
}
}
public static bool InPrison(Player p)
{
if ((Object)(object)p != (Object)null)
{
return MadCards.Has(p, SC.Prison);
}
return false;
}
public static bool Levitating(Player p)
{
if ((Object)(object)p != (Object)null)
{
return MadCards.Has(p, MadCards.Levitate);
}
return false;
}
private static void LevitateJump(PlayerJump j, bool forceJump, float multiplier)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
CharacterData data = j.data;
if (forceJump || !(data.sinceJump < 0.1f))
{
Vector3 val = Vector3.down;
if (data.sinceWallGrab < 0.1f && !data.isGrounded)
{
val = Vector2.op_Implicit(Vector2.down * 0.8f + data.wallNormal * 0.4f);
}
j.JumpAction?.Invoke();
if (data.playerVel.velocity.y > 0f)
{
data.playerVel.velocity = new Vector2(data.playerVel.velocity.x, 0f);
}
data.sinceJump = 0f;
data.isGrounded = false;
data.isWallGrab = false;
data.currentJumps = 99;
data.playerVel.AddForce(val * multiplier * 0.01f * data.stats.jump * data.playerVel.mass * (1f - j.stats.GetSlow()) * j.upForce, (ForceMode2D)1);
LevitateState component = ((Component)j).GetComponent<LevitateState>();
if ((Object)(object)component != (Object)null)
{
component.sinceCeiling = 1f;
}
}
}
}
public class LevitateState : MonoBehaviour
{
public float sinceCeiling;
private CollisionChecker checker;
private void Start()
{
checker = ((Component)this).GetComponent<CollisionChecker>();
if ((Object)(object)checker != (Object)null)
{
CollisionChecker obj = checker;
obj.collisionAction = (Action<Collision2D>)Delegate.Combine(obj.collisionAction, new Action<Collision2D>(OnCollide));
}
}
private void OnDestroy()
{
if ((Object)(object)checker != (Object)null)
{
CollisionChecker obj = checker;
obj.collisionAction = (Action<Collision2D>)Delegate.Remove(obj.collisionAction, new Action<Collision2D>(OnCollide));
}
}
private void OnCollide(Collision2D c)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
ContactPoint2D[] contacts = c.contacts;
if (contacts.Length != 0 && ((ContactPoint2D)(ref contacts[0])).normal.y < -0.5f)
{
sinceCeiling = 0f;
}
}
}
[HarmonyPatch(typeof(Gravity), "FixedUpdate")]
internal static class PatchGravity
{
private static bool Prefix(Gravity __instance)
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
if (!JumpHooks.Levitating(((Component)__instance).GetComponent<Player>()))
{
return true;
}
CharacterData data = __instance.data;
PlayerVelocity rig = __instance.rig;
if ((Object)(object)data == (Object)null || (Object)(object)rig == (Object)null)
{
return true;
}
LevitateState levitateState = ((Component)__instance).GetComponent<LevitateState>() ?? ((Component)__instance).gameObject.AddComponent<LevitateState>();
LegRaycasters componentInChildren = ((Component)__instance).GetComponentInChildren<LegRaycasters>();
int num = (((Object)(object)componentInChildren != (Object)null) ? LayerMask.op_Implicit(componentInChildren.mask) : (-1));
float num2 = 1f * ((Component)__instance).transform.localScale.x + 0.3f;
if (Physics2D.RaycastAll(Vector2.op_Implicit(((Component)__instance).transform.position), Vector2.up, num2, num).Any((RaycastHit2D h) => (Object)(object)((RaycastHit2D)(ref h)).collider != (Object)null && (Object)(object)((Component)((RaycastHit2D)(ref h)).collider).transform.root != (Object)(object)((Component)__instance).transform.root))
{
levitateState.sinceCeiling = 0f;
}
else
{
levitateState.sinceCeiling += Time.fixedDeltaTime * TimeHandler.timeScale;
}
float num3 = Mathf.Min(levitateState.sinceCeiling, data.sinceWallGrab);
float num4 = ((num3 > 0f) ? Mathf.Pow(num3, __instance.exponent) : num3);
rig.AddForce(Vector3.up * TimeHandler.timeScale * num4 * __instance.gravityForce * rig.mass, (ForceMode2D)0);
return false;
}
}
public static class ZeroBuildHooks
{
[HarmonyPatch(typeof(Block), "TryBlock")]
private static class PatchTryBlock
{
private static bool Prefix(Block __instance)
{
return !BlockSuppressed(((Component)__instance).GetComponent<Player>());
}
}
public const float Radius = 8f;
public static bool BlockSuppressed(Player blocker)
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)blocker == (Object)null || (Object)(object)MadCards.ZeroBuild == (Object)null)
{
return false;
}
foreach (Player player in PlayerManager.instance.players)
{
if (!((Object)(object)player == (Object)(object)blocker) && player.teamID != blocker.teamID && !player.data.dead && MadCards.Has(player, MadCards.ZeroBuild) && Vector2.Distance(Vector2.op_Implicit(((Component)player).transform.position), Vector2.op_Implicit(((Component)blocker).transform.position)) <= 8f)
{
return true;
}
}
return false;
}
}
public static class StoryNet
{
[HarmonyPatch(typeof(CardChoice), "RPCA_DoEndPick")]
private static class PatchDoEndPick
{
private static void Prefix(CardChoice __instance, int targetCardID, int pickId)
{
PhotonView photonView = PhotonNetwork.GetPhotonView(targetCardID);
CardInfo card = (((Object)(object)photonView != (Object)null) ? ((Component)photonView).GetComponent<CardInfo>() : null);
OnPicked(ResolvePicker(__instance, pickId), MadCards.KeyOf(card));
}
}
[HarmonyPatch(typeof(CardChoice), "SpawnUniqueCard")]
private static class PatchSpawn
{
private static int btSlot;
[HarmonyPriority(0)]
private static void Postfix(CardChoice __instance, ref GameObject __result, Vector3 pos, Quaternion rot)
{
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
Player val = ResolvePicker(__instance, __instance.pickrID);
if ((Object)(object)val == (Object)null)
{
return;
}
Transform[] children = __instance.children;
int num = ((children != null) ? children.Length : 0);
SC[] array = Engine.Layout(val.playerID, num);
int count = __instance.spawnedCards.Count;
if (array == null)
{
if (!Engine.OffersBeforeTaxes(val.playerID))
{
return;
}
if (count == 0)
{
btSlot = Random.Range(0, Mathf.Max(1, num));
}
if (count != btSlot || __instance.spawnedCards.Any((GameObject g) => MadCards.KeyOf(g.GetComponent<CardInfo>()) == SC.BeforeTaxes) || MadCards.KeyOf(((Object)(object)__result != (Object)null) ? __result.GetComponent<CardInfo>() : null) == SC.BeforeTaxes)
{
return;
}
array = new SC[num];
array[count] = SC.BeforeTaxes;
}
if (count < array.Length && MadCards.ByKey.TryGetValue(array[count], out var value))
{
if ((Object)(object)__result != (Object)null)
{
PhotonNetwork.Destroy(__result);
}
GameObject val2 = __instance.Spawn(((Component)value).gameObject, pos, rot);
val2.GetComponent<CardInfo>().sourceCard = value;
((Behaviour)((Component)val2.GetComponentInChildren<DamagableEvent>()).GetComponent<Collider2D>()).enabled = false;
__result = val2;
}
}
}
public static readonly StoryEngine Engine = new StoryEngine();
public static readonly Queue<bool> ForcedRolls = new Queue<bool>();
private static readonly Queue<Effect> queue = new Queue<Effect>();
private static bool running;
private static float pendingDelay;
public static int Busy => queue.Count + (running ? 1 : 0);
public static bool IsHost
{
get
{
if (!PhotonNetwork.OfflineMode && PhotonNetwork.CurrentRoom != null)
{
return PhotonNetwork.IsMasterClient;
}
return true;
}
}
public static void Init()
{
Engine.Log = delegate(string s)
{
MemeMadness.Log.LogInfo((object)("[Story] " + s));
};
GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OnGameStart);
GameModeManager.AddHook("PickStart", (Func<IGameModeHandler, IEnumerator>)OnPickStart);
Cards.instance.AddCardValidationFunction((Func<Player, CardInfo, bool>)((Player player, CardInfo card) => MadCards.KeyOf(card) != SC.BeforeTaxes || Engine.CanDrawNormally(SC.BeforeTaxes)));
}
private static IEnumerator OnGameStart(IGameModeHandler gm)
{
ResetAll();
yield break;
}
private static IEnumerator OnPickStart(IGameModeHandler gm)
{
Engine.OnPickPhaseStart();
yield break;
}
public static void ResetAll()
{
Engine.ResetGame();
queue.Clear();
ForcedRolls.Clear();
Engine.EnsurePlayers(AllPlayerIds());
}
public static IEnumerable<int> AllPlayerIds()
{
return PlayerManager.instance?.players?.Select((Player p) => p.playerID) ?? Enumerable.Empty<int>();
}
public static void OnPicked(Player player, SC key)
{
if (!((Object)(object)player == (Object)null))
{
Engine.EnsurePlayers(AllPlayerIds());
List<Effect> fx = Engine.OnPicked(player.playerID, key);
if (IsHost)
{
Enqueue(fx, 0.6f);
}
}
}
[UnboundRPC]
public static void RPCA_StoryRolled(int playerId, int roll, bool good)
{
List<Effect> fx = Engine.OnRolled(playerId, (Roll)roll, good);
if (IsHost)
{
Enqueue(fx, 0f);
}
}
private static void Enqueue(List<Effect> fx, float delay)
{
if (fx.Count == 0)
{
return;
}
pendingDelay = Mathf.Max(pendingDelay, delay);
foreach (Effect item in fx)
{
queue.Enqueue(item);
}
if (!running)
{
((MonoBehaviour)MemeMadness.Instance).StartCoroutine(Run());
}
}
private static IEnumerator Run()
{
running = true;
while (queue.Count > 0)
{
if (pendingDelay > 0f)
{
float num = pendingDelay;
pendingDelay = 0f;
yield return (object)new WaitForSecondsRealtime(num);
}
Effect effect = queue.Dequeue();
Player player = PlayerManager.instance.GetPlayerWithID(effect.Player);
if ((Object)(object)player == (Object)null)
{
continue;
}
switch (effect.What)
{
case Effect.Kind.Roll:
{
bool flag = ((ForcedRolls.Count > 0) ? ForcedRolls.Dequeue() : (Random.value < StoryEngine.Chance[effect.RollKind]));
MemeMadness.Log.LogInfo((object)string.Format("[Story] host rolled {0} for P{1}: {2}", effect.RollKind, effect.Player, flag ? "lucky" : "unlucky"));
NetworkingManager.RPC(typeof(StoryNet), "RPCA_StoryRolled", new object[3]
{
effect.Player,
(int)effect.RollKind,
flag
});
break;
}
case Effect.Kind.Remove:
{
List<SC> list = new List<SC> { effect.Card };
while (queue.Count > 0 && queue.Peek().What == Effect.Kind.Remove && queue.Peek().Player == effect.Player)
{
list.Add(queue.Dequeue().Card);
}
CardInfo[] array = (from k in list
where MadCards.Has(player, k)
select MadCards.ByKey[k]).ToArray();
if (array.Length != 0)
{
MemeMadness.Log.LogInfo((object)string.Format("[Story] P{0} loses {1}", effect.Player, string.Join(", ", array.Select((CardInfo c) => c.cardName.Trim()))));
Cards.instance.RemoveCardsFromPlayer(player, array, (SelectionType)0);
yield return (object)new WaitForSecondsRealtime(0.4f);
}
break;
}
case Effect.Kind.Add:
{
if (MadCards.ByKey.TryGetValue(effect.Card, out var value))
{
MemeMadness.Log.LogInfo((object)$"[Story] P{effect.Player} gets {value.cardName.Trim()}");
Cards.instance.AddCardToPlayer(player, value, false, "", 0f, 0f, true);
UndieHooks.Refill(player);
yield return (object)new WaitForSecondsRealtime(0.25f);
}
break;
}
}
}
running = false;
}
internal static Player ResolvePicker(CardChoice choice, int pickId)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (pickId < 0 || (Object)(object)PlayerManager.instance == (Object)null)
{
return null;
}
if ((int)choice.pickerType == 0)
{
return PlayerManager.instance.GetPlayersInTeam(pickId).FirstOrDefault();
}
return PlayerManager.instance.GetPlayerWithID(pickId);
}
}
}
namespace MemeMadness.Cards
{
public abstract class MemeCard : CustomCard
{
protected virtual string ArtFile => null;
protected override GameObject GetCardArt()
{
return Assets.CardArt(ArtFile);
}
protected override Rarity GetRarity()
{
return (Rarity)0;
}
protected override CardThemeColorType GetTheme()
{
return (CardThemeColorType)8;
}
public override string GetModName()
{
return "MEME";
}
public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
}
protected static CardInfoStat Stat(string name, string amount, bool positive)
{
return MemeStats.Stat(name, amount, positive);
}
protected static Rarity Rarity(string name)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return MemeStats.Rarity(name);
}
}
public abstract class MemeEffectCard<T> : CustomEffectCard<T> where T : CardEffect
{
private CardDetails<T> details;
protected abstract string Title { get; }
protected abstract string Description { get; }
protected virtual string ArtFile => null;
protected virtual Rarity CardRarity => (Rarity)0;
protected virtual CardThemeColorType Theme => (CardThemeColorType)8;
protected virtual CardInfoStat[] Stats => (CardInfoStat[])(object)new CardInfoStat[0];
protected virtual bool OwnerOnly => false;
public override CardDetails<T> Details
{
get
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
CardDetails<T> obj = details;
if (obj == null)
{
CardDetails<T> obj2 = new CardDetails<T>
{
Title = Title,
Description = Description,
ModName = "MEME",
Rarity = CardRarity,
Theme = Theme,
Stats = Stats,
Art = Assets.CardArt(ArtFile),
OwnerOnly = OwnerOnly
};
CardDetails<T> val = obj2;
details = obj2;
obj = val;
}
return obj;
}
}
protected static CardInfoStat Stat(string name, string amount, bool positive)
{
return MemeStats.Stat(name, amount, positive);
}
protected static Rarity Rarity(string name)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return MemeStats.Rarity(name);
}
}
public static class MemeStats
{
public static CardInfoStat Stat(string name, string amount, bool positive)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
return new CardInfoStat
{
stat = name,
amount = amount,
positive = positive,
simepleAmount = (SimpleAmount)0
};
}
public static Rarity Rarity(string name)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Rarity rarity = RarityUtils.GetRarity(name);
if ((int)rarity == 0 && name != "Common")
{
MemeMadness.Log.LogWarning((object)("Unknown rarity '" + name + "', using Common."));
}
return rarity;
}
}
public abstract class MadCard : MemeCard
{
protected static readonly (string, string, bool)[] Nothing = new(string, string, bool)[1] { ("", "Nothing", true) };
public virtual SC Key => SC.None;
protected abstract string Title { get; }
protected abstract string Art { get; }
protected abstract (string, string, bool)[] Lines { get; }
protected virtual bool Drawable => false;
protected virtual bool AllowMultiple => true;
protected virtual Rarity CardRarity => (Rarity)0;
protected virtual CardThemeColorType CardTheme => (CardThemeColorType)8;
public virtual int Undies => 0;
protected override string ArtFile => Art;
protected override string GetTitle()
{
return Title;
}
protected override string GetDescription()
{
return "";
}
protected override Rarity GetRarity()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return CardRarity;
}
protected override CardThemeColorType GetTheme()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return CardTheme;
}
public override bool GetEnabled()
{
return Drawable;
}
protected override CardInfoStat[] GetStats()
{
return Lines.Select(((string, string, bool) l) => MemeCard.Stat(l.Item2, l.Item1, l.Item3)).ToArray();
}
public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
{
cardInfo.allowMultiple = AllowMultiple;
Stats(gun, statModifiers, block);
}
protected virtual void Stats(Gun gun, CharacterStatModifiers stats, Block block)
{
}
protected static (string, string, bool) Line(string stat, bool good = true)
{
return ("", stat, good);
}
protected static (string, string, bool) Line(string amount, string stat, bool good)
{
return (amount, stat, good);
}
}
public static class MadCards
{
public static readonly Dictionary<SC, CardInfo> ByKey = new Dictionary<SC, CardInfo>();
public static readonly Dictionary<string, SC> KeyByName = new Dictionary<string, SC>();
public static readonly List<CardInfo> All = new List<CardInfo>();
public static CardInfo Levitate;
public static CardInfo ZeroBuild;
public static SC KeyOf(CardInfo card)
{
if ((Object)(object)card == (Object)null)
{
return SC.None;
}
CardInfo val = (((Object)(object)card.sourceCard != (Object)null) ? card.sourceCard : card);
if (!KeyByName.TryGetValue(((Object)val).name.Replace("(Clone)", ""), out var value))
{
return SC.None;
}
return value;
}
public static bool Has(Player p, CardInfo card)
{
if ((Object)(object)card != (Object)null)
{
return p.data.currentCards.Any((CardInfo c) => (Object)(object)c != (Object)null && ((Object)c).name == ((Object)card).name);
}
return false;
}
public static bool Has(Player p, SC key)
{
if (ByKey.TryGetValue(key, out var value))
{
return Has(p, value);
}
return false;
}
public static int Count(Player p, SC key)
{
if (!ByKey.TryGetValue(key, out var c))
{
return 0;
}
return p.data.currentCards.Count((CardInfo x) => (Object)(object)x != (Object)null && ((Object)x).name == ((Object)c).name);
}
public static void RegisterAll()
{
Register<Levitate>(delegate(CardInfo c)
{
Levitate = c;
});
Register<ZeroBuild>(delegate(CardInfo c)
{
ZeroBuild = c;
});
Register<BeforeTaxes>();
Register<AfterTaxes>();
Register<TaxEvasion>();
Register<TaxRefund>();
Register<PayTheFine>();
Register<FleeTheCountry>();
Register<FleeToAnotherCountry>();
Register<Extradited>();
Register<BribeTheAuditor>();
Register<Prison>();
Register<ServeYourTime1>();
Register<ServeYourTime2>();
Register<ServeYourTime3>();
Register<Reformed>();
Register<PrisonBreak>();
Register<SolitaryConfinement>();
Register<StareAtTheWall>();
Register<DigATunnel>();
Register<Caught>();
Register<HitThePrisonGym>();
Register<LiftWeights>();
Register<PrisonSteroids>();
Register<YardBoss>();
Register<MindYourBusiness>();
Register<GoViral>();
Register<ReleasedForBeingFamous>();
Register<StartAPodcast>();
Register<RunForPresident>();
Register<CampaignHonestly>();
Register<RigTheElection>();
Register<Concede>();
Register<President>();
Register<PresidentialDuties>();
Register<RaiseTaxes>();
}
private static void Register<T>(Action<CardInfo> extra = null) where T : MadCard
{
CustomCard.BuildCard<T>((Action<CardInfo>)delegate(CardInfo card)
{
MadCard component = ((Component)card).GetComponent<MadCard>();
All.Add(card);
if (component.Key != SC.None)
{
ByKey[component.Key] = card;
KeyByName[((Object)card).name] = component.Key;
}
if (!((CustomCard)component).GetEnabled())
{
Cards.instance.AddHiddenCard(card);
}
extra?.Invoke(card);
MemeMadness.Log.LogInfo((object)("Registered card: " + card.cardName.Trim() + " (" + (((CustomCard)component).GetEnabled() ? ((object)Unsafe.As<Rarity, Rarity>(ref card.rarity)/*cast due to .constrained prefix*/).ToString() : "story") + ")"));
});
}
}
public class Levitate : MadCard
{
protected override string Title => "Levitate";
protected override string Art => "levitate.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[3]
{
MadCard.Line("Fall up"),
MadCard.Line("Jump down"),
MadCard.Line("+inf", "Jumps", good: true)
};
protected override bool Drawable => true;
protected override bool AllowMultiple => false;
protected override Rarity CardRarity => MemeStats.Rarity("Epic");
protected override CardThemeColorType CardTheme => (CardThemeColorType)7;
}
public class ZeroBuild : MadCard
{
protected override string Title => "Zero Build";
protected override string Art => "zerobuild.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[1] { MadCard.Line("Opponents can't block near you") };
protected override bool Drawable => true;
protected override Rarity CardRarity => MemeStats.Rarity("Legendary");
protected override CardThemeColorType CardTheme => (CardThemeColorType)2;
}
public class BeforeTaxes : MadCard
{
public override SC Key => SC.BeforeTaxes;
protected override string Title => "Before Taxes";
protected override string Art => "beforetaxes.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("x10", "Damage", good: true),
MadCard.Line("x2", "HP", good: true)
};
protected override bool Drawable => true;
protected override bool AllowMultiple => false;
protected override Rarity CardRarity => (Rarity)2;
protected override CardThemeColorType CardTheme => (CardThemeColorType)1;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
g.damage = 10f;
s.health = 2f;
}
}
public class AfterTaxes : MadCard
{
public override SC Key => SC.AfterTaxes;
protected override string Title => "After Taxes";
protected override string Art => "aftertaxes.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[1] { MadCard.Line("-Before Taxes", good: false) };
protected override CardThemeColorType CardTheme => (CardThemeColorType)4;
}
public class TaxEvasion : MadCard
{
public override SC Key => SC.TaxEvasion;
protected override string Title => "Tax Evasion";
protected override string Art => "taxevasion.png";
protected override (string, string, bool)[] Lines => MadCard.Nothing;
protected override CardThemeColorType CardTheme => (CardThemeColorType)4;
}
public class TaxRefund : MadCard
{
public override SC Key => SC.TaxRefund;
protected override string Title => "Tax Refund";
protected override string Art => "taxrefund.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("+20%", "Damage", good: true),
MadCard.Line("+20%", "HP", good: true)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)2;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
g.damage = 1.2f;
s.health = 1.2f;
}
}
public class PayTheFine : MadCard
{
public override SC Key => SC.PayTheFine;
protected override string Title => "Pay the Fine";
protected override string Art => "paythefine.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("-Before Taxes", good: false),
MadCard.Line("-50%", "HP", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)0;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
s.health = 0.5f;
}
}
public class FleeTheCountry : MadCard
{
public override SC Key => SC.FleeTheCountry;
protected override string Title => "Flee the Country";
protected override string Art => "fleethecountry.png";
protected override (string, string, bool)[] Lines => MadCard.Nothing;
protected override CardThemeColorType CardTheme => (CardThemeColorType)6;
}
public class FleeToAnotherCountry : MadCard
{
public override SC Key => SC.FleeToAnotherCountry;
protected override string Title => "Flee to Another Country";
protected override string Art => "fleetoanothercountry.png";
protected override (string, string, bool)[] Lines => MadCard.Nothing;
protected override CardThemeColorType CardTheme => (CardThemeColorType)6;
}
public class Extradited : MadCard
{
public override SC Key => SC.Extradited;
protected override string Title => "Extradited";
protected override string Art => "extradited.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("-Before Taxes", good: false),
MadCard.Line("+Prison", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)0;
}
public class BribeTheAuditor : MadCard
{
public override SC Key => SC.BribeTheAuditor;
protected override string Title => "Bribe the Auditor";
protected override string Art => "bribetheauditor.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("10% chance", "get away", good: true),
MadCard.Line("90%", "prison", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)4;
}
public class Prison : MadCard
{
public override SC Key => SC.Prison;
protected override string Title => "Prison";
protected override string Art => "prison.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("-50%", "speed", good: false),
MadCard.Line("-inf", "jumps", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)7;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
s.movementSpeed = 0.5f;
}
}
public abstract class ServeYourTimeBase : MadCard
{
protected abstract int Step { get; }
protected override string Title => "Serve Your Time" + new string(' ', Step - 1);
protected override string Art => "serveyourtime.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[1] { MadCard.Line($"{Step}/3") };
protected override CardThemeColorType CardTheme => (CardThemeColorType)3;
}
public class ServeYourTime1 : ServeYourTimeBase
{
public override SC Key => SC.ServeYourTime1;
protected override int Step => 1;
}
public class ServeYourTime2 : ServeYourTimeBase
{
public override SC Key => SC.ServeYourTime2;
protected override int Step => 2;
}
public class ServeYourTime3 : ServeYourTimeBase
{
public override SC Key => SC.ServeYourTime3;
protected override int Step => 3;
}
public class Reformed : MadCard
{
public override SC Key => SC.Reformed;
protected override string Title => "Reformed";
protected override string Art => "reformed.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("x3", "Damage", good: true),
MadCard.Line("x3", "HP", good: true)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)8;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
g.damage = 3f;
s.health = 3f;
}
}
public class PrisonBreak : MadCard
{
public override SC Key => SC.PrisonBreak;
protected override string Title => "Prison Break";
protected override string Art => "prisonbreak.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("50% chance", "get on the run", good: true),
MadCard.Line("50% chance", "solitary confinement", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)0;
}
public class SolitaryConfinement : MadCard
{
public override SC Key => SC.SolitaryConfinement;
protected override string Title => "Solitary Confinement";
protected override string Art => "solitaryconfinement.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("-50%", "attack speed", good: false),
MadCard.Line("-50%", "dmg", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)7;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
g.attackSpeed = 2f;
g.damage = 0.5f;
}
}
public class StareAtTheWall : MadCard
{
public override SC Key => SC.StareAtTheWall;
protected override string Title => "Stare at the Wall";
protected override string Art => "stareatthewall.png";
protected override (string, string, bool)[] Lines => MadCard.Nothing;
protected override CardThemeColorType CardTheme => (CardThemeColorType)3;
}
public class DigATunnel : MadCard
{
public override SC Key => SC.DigATunnel;
protected override string Title => "Dig a Tunnel";
protected override string Art => "digatunnel.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("60%", "escape", good: true),
MadCard.Line("40%", "caught", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)6;
}
public class Caught : MadCard
{
public override SC Key => SC.Caught;
protected override string Title => "Caught";
protected override string Art => "caught.png";
protected override (string, string, bool)[] Lines => MadCard.Nothing;
protected override CardThemeColorType CardTheme => (CardThemeColorType)0;
}
public class HitThePrisonGym : MadCard
{
public override SC Key => SC.HitThePrisonGym;
protected override string Title => "Hit the Prison Gym";
protected override string Art => "hittheprisongym.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("+5%", "damage", good: true),
MadCard.Line("+5%", "hp", good: true)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)6;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
g.damage = 1.05f;
s.health = 1.05f;
}
}
public class LiftWeights : MadCard
{
public override SC Key => SC.LiftWeights;
protected override string Title => "Lift Weights";
protected override string Art => "liftweights.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("+10%", "damage", good: true),
MadCard.Line("+10%", "hp", good: true)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)6;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
g.damage = 1.1f;
s.health = 1.1f;
}
}
public class PrisonSteroids : MadCard
{
public override SC Key => SC.PrisonSteroids;
protected override string Title => "Prison Steroids";
protected override string Art => "prisonsteroids.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("50%", "yard boss", good: true),
MadCard.Line("50%", "solitary confinement", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)5;
}
public class YardBoss : MadCard
{
public override SC Key => SC.YardBoss;
protected override string Title => "Yard Boss";
protected override string Art => "yardboss.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[1] { MadCard.Line("x2", "HP", good: true) };
protected override CardThemeColorType CardTheme => (CardThemeColorType)6;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
s.health = 2f;
}
}
public class MindYourBusiness : MadCard
{
public override SC Key => SC.MindYourBusiness;
protected override string Title => "Mind Your Business";
protected override string Art => "mindyourbusiness.png";
protected override (string, string, bool)[] Lines => MadCard.Nothing;
protected override CardThemeColorType CardTheme => (CardThemeColorType)3;
}
public class GoViral : MadCard
{
public override SC Key => SC.GoViral;
protected override string Title => "Go Viral";
protected override string Art => "goviral.png";
protected override (string, string, bool)[] Lines => MadCard.Nothing;
protected override CardThemeColorType CardTheme => (CardThemeColorType)8;
}
public class ReleasedForBeingFamous : MadCard
{
public override SC Key => SC.ReleasedForBeingFamous;
protected override string Title => "Released for Being Famous";
protected override string Art => "releasedforbeingfamous.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[1] { MadCard.Line("+1", "undie", good: true) };
protected override CardThemeColorType CardTheme => (CardThemeColorType)8;
public override int Undies => 1;
}
public class StartAPodcast : MadCard
{
public override SC Key => SC.StartAPodcast;
protected override string Title => "Start a Podcast";
protected override string Art => "startapodcast.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[1] { MadCard.Line("+1", "undie", good: true) };
protected override CardThemeColorType CardTheme => (CardThemeColorType)3;
public override int Undies => 1;
}
public class RunForPresident : MadCard
{
public override SC Key => SC.RunForPresident;
protected override string Title => "Run for President";
protected override string Art => "runforpresident.png";
protected override (string, string, bool)[] Lines => MadCard.Nothing;
protected override CardThemeColorType CardTheme => (CardThemeColorType)2;
}
public class CampaignHonestly : MadCard
{
public override SC Key => SC.CampaignHonestly;
protected override string Title => "Campaign Honestly";
protected override string Art => "campaignhonestly.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("10% chance", "win", good: true),
MadCard.Line("90% chance", "lose", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)2;
}
public class RigTheElection : MadCard
{
public override SC Key => SC.RigTheElection;
protected override string Title => "Rig the Election";
protected override string Art => "rigtheelection.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[2]
{
MadCard.Line("90% chance", "win", good: true),
MadCard.Line("10% chance", "caught", good: false)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)4;
}
public class Concede : MadCard
{
public override SC Key => SC.Concede;
protected override string Title => "Concede";
protected override string Art => "concede.png";
protected override (string, string, bool)[] Lines => MadCard.Nothing;
protected override CardThemeColorType CardTheme => (CardThemeColorType)3;
}
public class President : MadCard
{
public override SC Key => SC.President;
protected override string Title => "President";
protected override string Art => "president.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[3]
{
MadCard.Line("x2", "damage", good: true),
MadCard.Line("x2", "hp", good: true),
MadCard.Line("+2", "undie", good: true)
};
protected override CardThemeColorType CardTheme => (CardThemeColorType)1;
public override int Undies => 2;
protected override void Stats(Gun g, CharacterStatModifiers s, Block b)
{
g.damage = 2f;
s.health = 2f;
}
}
public class PresidentialDuties : MadCard
{
public override SC Key => SC.PresidentialDuties;
protected override string Title => "Presidential Duties";
protected override string Art => "presidentialduties.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[1] { MadCard.Line("The end") };
protected override CardThemeColorType CardTheme => (CardThemeColorType)2;
}
public class RaiseTaxes : MadCard
{
public override SC Key => SC.RaiseTaxes;
protected override string Title => "Raise Taxes";
protected override string Art => "raisetaxes.png";
protected override (string, string, bool)[] Lines => new(string, string, bool)[1] { MadCard.Line("The end") };
protected override CardThemeColorType CardTheme => (CardThemeColorType)4;
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}