├── PreRelease ├── Resources │ └── Data │ │ ├── dummy.txt │ │ ├── Items_Traps.csv │ │ ├── Items_Barricading.csv │ │ ├── Items_Scentsprays.csv │ │ ├── Items_Entertainment.csv │ │ ├── Items_Explosives.csv │ │ ├── Items_Lights.csv │ │ ├── Items_Spraypaints.csv │ │ ├── Items_Trackers.csv │ │ ├── Items_Food.csv │ │ ├── Items_Medicine.csv │ │ ├── Items_Armors.csv │ │ ├── Items_RangedWeapons.csv │ │ ├── Skills.csv │ │ ├── Items_MeleeWeapons.csv │ │ └── Actors.csv └── readme.txt ├── RogueSurvivor ├── IconPNG.ico ├── lib │ ├── sfmlnet-audio.dll │ └── sfmlnet-window.dll ├── app.config ├── RSConfig │ ├── RSConfig.csproj.user │ └── RSConfig.cs ├── packages.config ├── Data │ ├── BatteryPowered.cs │ ├── IInventory.cs │ ├── DollBody.cs │ ├── Waypoint.cs │ ├── DollPart.cs │ ├── Model │ │ ├── PrimedExplosive.cs │ │ ├── BodyArmor.cs │ │ └── Explosive.cs │ ├── ActorCourage.cs │ ├── Weather.cs │ ├── Verb.cs │ ├── ActorDirective.cs │ ├── Item │ │ └── PrimedExplosive.cs │ ├── Defence.cs │ ├── TileModel.cs │ ├── BlastAttack.cs │ ├── TimedTask.cs │ ├── Doll.cs │ ├── StateMapObject.cs │ ├── Odor.cs │ ├── Faction.cs │ └── SkillTable.cs ├── AssemblyInfo.cs ├── Zaimoni │ ├── Data │ │ ├── KVpair.cs │ │ ├── Operator.cs │ │ ├── UntypedCache.cs │ │ ├── OutTextFile.cs │ │ ├── Observer.cs │ │ ├── Cache.cs │ │ ├── TimeCache.cs │ │ ├── Logger.cs │ │ ├── JSON.cs │ │ ├── FileExt.cs │ │ └── Stack.cs │ ├── Lazy │ │ └── Join.cs │ ├── Serialization │ │ ├── StreamingContext.cs │ │ └── SaveManager.cs │ └── Collections │ │ └── Enumerator.cs ├── RogueSurvivor.csproj.user ├── Engine │ ├── RaidType.cs │ ├── UniqueMap.cs │ ├── AI │ │ └── Sensor.cs │ ├── GameMode.cs │ ├── Actions │ │ ├── ActionSleep.cs │ │ ├── ActionWait.cs │ │ ├── ActionButcher.cs │ │ ├── ActionShout.cs │ │ ├── ActionUnequipItem.cs │ │ ├── ActionChat.cs │ │ ├── ActionEatFoodOnGround.cs │ │ ├── ActionEquipItem.cs │ │ ├── ActionTrade.cs │ │ ├── ActionSay.cs │ │ ├── ActionDropItem.cs │ │ ├── ActionMeleeAttack.cs │ │ ├── ActionSwitchPowerGenerator.cs │ │ ├── ActionOpenDoor.cs │ │ ├── ActionBarricadeDoor.cs │ │ ├── ActionReviveCorpse.cs │ │ ├── ActionPutInContainer.cs │ │ ├── ActionShove.cs │ │ ├── ActionTakeLead.cs │ │ ├── ActionLeaveMap.cs │ │ ├── ActionCloseDoor.cs │ │ ├── ActionUseExit.cs │ │ ├── ActionSwitchPlace.cs │ │ ├── ActionBump.cs │ │ ├── ActionMoveStep.cs │ │ ├── ActionSequence.cs │ │ ├── ActionEatCorpse.cs │ │ ├── ActionRechargeItemBattery.cs │ │ ├── ActionPull.cs │ │ ├── ActionUseItem.cs │ │ └── ActionSprayOdorSuppressor.cs │ ├── Items │ │ ├── ItemWeapon.cs │ │ ├── ItemWeaponModel.cs │ │ ├── ItemGrenade.cs │ │ ├── ItemAmmoModel.cs │ │ ├── ItemExplosive.cs │ │ ├── ItemGrenadePrimed.cs │ │ ├── ItemBarricadeMaterial.cs │ │ ├── ItemEntertainmentModel.cs │ │ ├── ItemSprayScentModel.cs │ │ ├── ItemBarricadeMaterialModel.cs │ │ ├── ItemMeleeWeapon.cs │ │ ├── ItemSprayPaintModel.cs │ │ ├── ItemLightModel.cs │ │ ├── ItemMedicineModel.cs │ │ ├── ItemRangedWeaponModel.cs │ │ ├── ItemFoodModel.cs │ │ ├── ItemSprayScent.cs │ │ ├── ItemPrimedExplosive.cs │ │ ├── ItemSprayPaint.cs │ │ ├── AmmoType.cs │ │ └── ItemMeleeWeaponModel.cs │ ├── CSVField.cs │ ├── UniqueItems.cs │ ├── UniqueActor.cs │ ├── MapObjects │ │ ├── Board.cs │ │ └── Fortification.cs │ ├── Achievement.cs │ ├── Goal │ │ ├── DeathTrapped.cs │ │ └── CoverTrap.cs │ ├── CSVLine.cs │ ├── AdvisorHint.cs │ ├── NullSoundManager.cs │ ├── Tasks │ │ ├── TaskRemoveDecoration.cs │ │ └── TaskEscapeNanny.cs │ ├── PlayerCommand.cs │ ├── Action │ │ ├── BehavioristABC.cs │ │ └── Choice.cs │ ├── UniqueItem.cs │ ├── HiScore.cs │ └── CSVParser.cs ├── PointExtensions.cs ├── Properties │ ├── Settings.cs │ └── Resources.cs ├── UI │ ├── README.txt │ ├── Message.cs │ └── IGameCanvas.cs ├── Gameplay │ ├── GameSounds.cs │ ├── AI │ │ ├── Goals │ │ │ ├── StageAction.cs │ │ │ └── Pathfinder.cs │ │ ├── Sensors │ │ │ └── SmellSensor.cs │ │ ├── SkeletonAI.cs │ │ └── RatAI.cs │ ├── GameGangs.cs │ └── GameTips.cs └── Logger_mock.cs ├── README.md └── .hgtags /PreRelease/Resources/Data/dummy.txt: -------------------------------------------------------------------------------- 1 | Don't delete me. -------------------------------------------------------------------------------- /RogueSurvivor/IconPNG.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zaimoni/RSRevived/HEAD/RogueSurvivor/IconPNG.ico -------------------------------------------------------------------------------- /RogueSurvivor/lib/sfmlnet-audio.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zaimoni/RSRevived/HEAD/RogueSurvivor/lib/sfmlnet-audio.dll -------------------------------------------------------------------------------- /RogueSurvivor/lib/sfmlnet-window.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zaimoni/RSRevived/HEAD/RogueSurvivor/lib/sfmlnet-window.dll -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Traps.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zaimoni/RSRevived/HEAD/PreRelease/Resources/Data/Items_Traps.csv -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Barricading.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","VALUE","STACKINGLIMIT","FLAVOR" 2 | "BAR_WOODEN_PLANK","wooden plank","wooden planks",20,4,"Carpentry." 3 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Scentsprays.csv: -------------------------------------------------------------------------------- 1 | ID,NAME,PLURAL,QUANTITY,"STRENGTH in hours",FLAVOR 2 | SCENT_SPRAY_STENCH_KILLER,"stench killer","stench killers",40,3,"Smells like nothing." -------------------------------------------------------------------------------- /RogueSurvivor/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Entertainment.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","STACKING","VALUE","BORE CHANCE per use","FLAVOR" 2 | "ENT_BOOK","book","books",1,120,5,"Read while you still can." 3 | "ENT_MAGAZINE","magazine","magazines",10,60,100,"Emergency toilet paper." -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Explosives.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","FUSE","MAXTHROW","STACKINGLIMIT","RADIUS","BLAST0","BLAST1","BLAST2","BLAST3","BLAST4","BLAST5","FLAVOR" 2 | "EXPLOSIVE_GRENADE","grenade","grenades",2,5,6,2,120,60,40,0,0,0,"Fire in the hole!" 3 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Lights.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","FOV bonus","BATTERIES in hours","FLAVOR" 2 | "LIGHT_FLASHLIGHT","flashlight","flashlights",1,24,"Let There Be Light!" 3 | "LIGHT_BIG_FLASHLIGHT","big flashlight","big flashlights",2,8,"Let There Be MORE Light!" 4 | -------------------------------------------------------------------------------- /RogueSurvivor/RSConfig/RSConfig.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Form 7 | 8 | 9 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Spraypaints.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","QUANTITY","FLAVOR" 2 | "SPRAY_PAINT1","spray paint can","spray paint cans",10,"Yo Yellow!" 3 | "SPRAY_PAINT2","spray paint can","spray paint cans",10,"Yo Blue!" 4 | "SPRAY_PAINT3","spray paint can","spray paint cans",10,"Yo Red!" 5 | "SPRAY_PAINT4","spray paint can","spray paint cans",10,"Yo... Pink!?" 6 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Trackers.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","BATTERIES in hours","FLAVOR" 2 | "TRACKER_CELL_PHONE","cell phone","cell phones",72,"Hello? Still alive?" 3 | "TRACKER_ZTRACKER","Z-tracker","Z-trackers",8,"Aliens?" 4 | "TRACKER_BLACKOPS","blackOps GPS","blackOps GPS",2,"Good instadeath-Prediction System." 5 | "TRACKER_POLICE_RADIO","police radio","police radios",8,"Call 911 for zombies." 6 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Food.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","NUTRITION ratio of base food points","BESTBEFORE in days","STACKINGLIMIT","FLAVOR" 2 | "FOOD_ARMY_RATION","army ration","army rations",0.25,5,1,"Eat like a good soldier!" 3 | "FOOD_CANNED_FOOD","canned food","canned food",0.11,-1,3,"Better than dog food." 4 | "FOOD_GROCERIES","groceries","groceries",0.33,3,1,"They eat brains, you eat vegetables." 5 | -------------------------------------------------------------------------------- /RogueSurvivor/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/BatteryPowered.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace djack.RogueSurvivor.Data 4 | { 5 | public interface BatteryPowered 6 | { 7 | int Batteries { get; set; } 8 | int MaxBatteries { get; } 9 | int RechargeRate { get { return Math.Max(WorldTime.TURNS_PER_HOUR, MaxBatteries / 8); } } 10 | void Recharge() { Batteries += RechargeRate; } 11 | 12 | bool AugmentsSenses(Actor a); 13 | } 14 | } -------------------------------------------------------------------------------- /RogueSurvivor/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using djack.RogueSurvivor; 6 | 7 | [assembly: AssemblyDescription("")] 8 | [assembly: AssemblyTrademark("")] 9 | [assembly: ComVisible(false)] 10 | [assembly: Guid("8a2b9c0a-6dcb-4dfc-b96a-ade733831802")] 11 | [assembly: AssemblyTitle(SetupConfig.GAME_NAME+" " + SetupConfig.GAME_VERSION)] 12 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/KVpair.cs: -------------------------------------------------------------------------------- 1 | namespace Zaimoni.Data 2 | { 3 | // for when the readonly value of the canonical KeyValuePair is problematic. 4 | // 2021-01-24: struct version cannot assign to Value reliably after construction 5 | public class KVpair 6 | { 7 | public readonly K Key; 8 | public V Value; 9 | 10 | public KVpair(K k, V v) { 11 | Key = k; 12 | Value = v; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /RogueSurvivor/RogueSurvivor.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Form 7 | 8 | 9 | Form 10 | 11 | 12 | UserControl 13 | 14 | 15 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/IInventory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace djack.RogueSurvivor.Data 8 | { 9 | internal interface IInventory 10 | { 11 | public Inventory Inventory { get; } 12 | 13 | bool IsCarrying(Item it); 14 | bool IsCarrying(RogueSurvivor.Gameplay.Item_IDs it); 15 | 16 | void Remove(Item it, bool canMessage = true); 17 | bool CanTake(Item it); 18 | bool Take(Item it); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/DollBody.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.DollBody 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | namespace djack.RogueSurvivor.Data 8 | { 9 | public class DollBody 10 | { 11 | public readonly bool IsMale; 12 | public readonly int Speed; 13 | 14 | public DollBody(bool isMale, int speed) 15 | { 16 | IsMale = isMale; 17 | Speed = speed; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Medicine.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","HP","STA","SLP","INF","SAN","STACKING","FLAVOR" 2 | "MEDICINE_BANDAGES","bandages","bandages",2,0,0,0,0,5,"Nothing. A little blood." 3 | "MEDICINE_MEDIKIT","medikit","medikit",10,0,0,4,0,0,"Saves lives. Especially yours." 4 | "MEDICINE_PILLS_STA","green pills","green pills",0,20,0,0,0,20,"Gives a good kick in the ass." 5 | "MEDICINE_PILLS_SLP","blue pills","blue pills",0,0,120,0,0,20,"HEY! WAKE UP!" 6 | "MEDICINE_PILLS_SAN","orange pills","orange pills",0,0,0,0,30,20,"Everything will be fine." 7 | "MEDICINE_PILLS_ANTIVIRAL","antiviral pills","antiviral pills",0,0,0,12,0,6,"Kill it with pills." 8 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/RaidType.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.RaidType 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Engine 10 | { 11 | [Serializable] 12 | public enum RaidType 13 | { 14 | BIKERS = 0, 15 | GANGSTA = 1, 16 | BLACKOPS = 2, 17 | SURVIVORS = 3, 18 | NATGUARD = 4, 19 | ARMY_SUPLLIES = 5, 20 | _COUNT = 6, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/UniqueMap.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.UniqueMap 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine 13 | { 14 | [Serializable] 15 | public readonly struct UniqueMap 16 | { 17 | public readonly Map TheMap; 18 | public UniqueMap(Map src) { TheMap = src; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /RogueSurvivor/RSConfig/RSConfig.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: Setup.Program 3 | // Assembly: RSConfig, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: 5A6245E6-7D9A-4424-BC16-B17B9A5036B9 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RSConfig.exe 6 | 7 | using System; 8 | using System.Windows.Forms; 9 | 10 | namespace Setup 11 | { 12 | internal static class Program 13 | { 14 | [STAThread] 15 | private static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new ConfigForm()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/Operator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | #nullable enable 4 | 5 | namespace Zaimoni.Data 6 | { 7 | public interface Operator where OP:class 8 | { 9 | bool IsLegal(); 10 | OP? Bind(SRC src); 11 | } 12 | 13 | internal interface BackwardPlan 14 | { 15 | List? prequel(); 16 | } 17 | 18 | internal interface CanReduce 19 | { 20 | OP? Reduce(); 21 | } 22 | 23 | internal interface CanComplete 24 | { 25 | bool IsCompleted(SRC src); 26 | } 27 | 28 | internal interface CanFinish 29 | { 30 | bool IsCompleted(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/AI/Sensor.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.AI.Sensor 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | #nullable enable 8 | 9 | using System.Collections.Generic; 10 | 11 | using Actor = djack.RogueSurvivor.Data.Actor; 12 | using Percept = djack.RogueSurvivor.Engine.AI.Percept_; 13 | 14 | namespace djack.RogueSurvivor.Engine.AI 15 | { 16 | internal interface Sensor 17 | { 18 | List Sense(); 19 | Actor Viewpoint { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /RogueSurvivor/PointExtensions.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.PointExtensions 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System.Drawing; 8 | 9 | namespace djack.RogueSurvivor 10 | { 11 | public static class PointExtensions 12 | { 13 | public static Point Add(this Point pt, int x, int y) 14 | { 15 | return new Point(pt.X + x, pt.Y + y); 16 | } 17 | 18 | public static Point Add(this Point pt, Point other) 19 | { 20 | return new Point(pt.X + other.X, pt.Y + other.Y); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/GameMode.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.GameMode 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Engine 10 | { 11 | [Serializable] 12 | public enum GameMode 13 | { 14 | #if false 15 | GM_STANDARD, 16 | #endif 17 | GM_CORPSES_INFECTION = 1, 18 | GM_VINTAGE, 19 | GM_WORLD_WAR_Z, 20 | } 21 | 22 | internal enum GameMode_Bounds 23 | { 24 | _COUNT = (int)GameMode.GM_WORLD_WAR_Z + 1 25 | #if true 26 | - 1 27 | #endif 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_Armors.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","PRO_HIT","PRO_SHOT","ENC","WEIGHT","FLAVOR" 2 | "ARMOR_ARMY_BODYARMOR","army body armor","army body armors",6,8,6,10,"You look manly!" 3 | "ARMOR_CHAR_LIGHT_BODYARMOR","CHAR body armor","CHAR body armors",4,4,4,10,"Oh! Suits you sir!" 4 | "ARMOR_HELLS_SOULS_JACKET","Hell's Souls jacket","Hell's Souls jackets",3,0,0,0,"Rock'n'roll." 5 | "ARMOR_FREE_ANGELS_JACKET","Free Angels jacket","Free Angels jackets",2,1,0,0,"Rock'n'roll." 6 | "ARMOR_POLICE_JACKET","police padded jacket","police padded jackets",2,2,0,0,"Law, Order and Padded Jackets." 7 | "ARMOR_POLICE_RIOT","anti-riot armor","anti-riot armors",3,3,2,0,"Standard Anti Zombie Riots Gear." 8 | "ARMOR_HUNTER_VEST","hunter vest","hunter vests",1,1,0,0,"It's pretty wild out there." 9 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Waypoint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace djack.RogueSurvivor.Data 8 | { 9 | [Serializable] 10 | internal class Waypoint 11 | { 12 | public Location dest; 13 | public string label; 14 | 15 | public Waypoint(Location loc, string text) 16 | { 17 | dest = loc; 18 | label = text; 19 | } 20 | }; 21 | 22 | [Serializable] 23 | public struct Waypoint_s 24 | { 25 | public Location dest; 26 | public string label; 27 | 28 | public Waypoint_s(Location loc, string text) { 29 | dest = loc; 30 | label = text; 31 | } 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionSleep.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionSleep 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | using djack.RogueSurvivor.Data; 10 | 11 | #nullable enable 12 | 13 | namespace djack.RogueSurvivor.Engine.Actions 14 | { 15 | [Serializable] 16 | internal class ActionSleep : ActorAction 17 | { 18 | public ActionSleep(Actor actor) : base(actor) {} 19 | public override bool IsLegal() => m_Actor.CanSleep(out m_FailReason); 20 | public override void Perform() => m_Actor.StartSleeping(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/DollPart.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.DollPart 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Data 10 | { 11 | [Serializable] 12 | public enum DollPart 13 | { 14 | NONE = 0, 15 | RIGHT_HAND = 1, 16 | _FIRST = RIGHT_HAND, // actually want this since NONE is not a valid decoration index 17 | LEFT_HAND = 2, 18 | HEAD = 3, 19 | TORSO = 4, 20 | LEGS = 5, 21 | FEET = 6, 22 | SKIN = 7, 23 | EYES = 8, 24 | _COUNT = 9, // last decoration index 25 | HIP_HOLSTER = _COUNT, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Model/PrimedExplosive.cs: -------------------------------------------------------------------------------- 1 | namespace djack.RogueSurvivor.Data.Model 2 | { 3 | public class PrimedExplosive : Item 4 | { 5 | public readonly int FuseDelay; 6 | private readonly BlastAttack m_Attack; 7 | 8 | public ref readonly BlastAttack BlastAttack { get { return ref m_Attack; } } 9 | 10 | public PrimedExplosive(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, int fuseDelay, BlastAttack attack, string flavor) 11 | : base(_id, aName, theNames, imageID, flavor, DollPart.RIGHT_HAND) 12 | { 13 | FuseDelay = fuseDelay; 14 | m_Attack = attack; 15 | } 16 | 17 | public override Data._Item.PrimedExplosive from(in Item_s src) => new(Gameplay.GameItems.From((Gameplay.Item_IDs)((int)ID-1)) as Explosive, src.QtyLike); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionWait.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionWait 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using djack.RogueSurvivor.Data; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Actions 13 | { 14 | [Serializable] 15 | internal class ActionWait : ActorAction 16 | { 17 | public ActionWait(Actor actor) 18 | : base(actor) 19 | { 20 | actor.Activity = Activity.IDLE; // normal state of a waiting actor 21 | } 22 | 23 | public override bool IsLegal() { return true; } 24 | public override void Perform() { RogueGame.Game.DoWait(m_Actor); } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Lazy/Join.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Zaimoni.Lazy 8 | { 9 | public class Join where T : class 10 | { 11 | private readonly T relay; 12 | private readonly Action onDone; 13 | private long latch = 0; 14 | 15 | public Join(T src, Action handler) 16 | { 17 | relay = src; 18 | onDone = handler; 19 | } 20 | 21 | public void Schedule() => latch++; 22 | 23 | public bool signal() 24 | { 25 | if (0 < --latch) return false; 26 | onDone(relay); 27 | return true; 28 | } 29 | 30 | public bool isDone() { 31 | if (0 < latch) return false; 32 | onDone(relay); 33 | return true; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /RogueSurvivor/Properties/Settings.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Properties.Settings 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System.CodeDom.Compiler; 8 | using System.Configuration; 9 | using System.Runtime.CompilerServices; 10 | 11 | namespace djack.RogueSurvivor.Properties 12 | { 13 | [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 14 | [CompilerGenerated] 15 | internal sealed class Settings : ApplicationSettingsBase 16 | { 17 | readonly private static Settings defaultInstance = (Settings) SettingsBase.Synchronized((SettingsBase) new Settings()); 18 | 19 | public static Settings Default { get { return Settings.defaultInstance; } } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /RogueSurvivor/UI/README.txt: -------------------------------------------------------------------------------- 1 | This is intended to be the subdirectory for dependencies involving System.Drawing (a Windows-specific C# library) 2 | 3 | Application class version: System.Windows.Forms Application https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.application?view=net-5.0 4 | Top-level event pump: System.Windows.Forms Form https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.form?view=net-5.0 5 | Canvas: System.Windows.Forms UserControl https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.usercontrol?view=net-5.0 6 | 7 | The vaporware directory for Windows Presentation Foundation applications would have parallel setup: 8 | 9 | Application class version: System.Windows Application https://docs.microsoft.com/en-us/dotnet/api/system.windows.application?view=net-5.0 10 | Top-level event pump: 11 | Canvas: System.Windows.Controls Canvas https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.canvas?view=net-5.0 12 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionButcher.cs: -------------------------------------------------------------------------------- 1 | using djack.RogueSurvivor.Data; 2 | 3 | #nullable enable 4 | 5 | namespace djack.RogueSurvivor.Engine.Actions 6 | { 7 | internal class ActionButcher : ActorAction, NotSchedulable 8 | { 9 | private readonly Corpse m_Target; 10 | 11 | public ActionButcher(Actor actor, Corpse target) : base(actor) 12 | { 13 | m_Target = target; 14 | } 15 | 16 | public override bool IsLegal() 17 | { 18 | m_FailReason = ReasonCant(m_Actor, m_Target); 19 | return string.IsNullOrEmpty(m_FailReason); 20 | } 21 | 22 | public override void Perform() 23 | { 24 | RogueGame.Game.DoButcherCorpse(m_Actor, m_Target); 25 | } 26 | 27 | public static string? ReasonCant(Actor a, Corpse c) { 28 | if (a.IsTired) return "tired"; 29 | if (c.Location != a.Location || !a.Location.Map.Has(c)) return "not in same location"; 30 | return null; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /RogueSurvivor/Gameplay/GameSounds.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Gameplay.GameSounds 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | namespace djack.RogueSurvivor.Gameplay 8 | { 9 | internal static class GameSounds 10 | { 11 | #if LINUX 12 | private const string PATH = "Resources/Sfx/"; 13 | #else 14 | private const string PATH = "Resources\\Sfx\\"; 15 | #endif 16 | public const string UNDEAD_EAT = "undead eat"; 17 | public const string UNDEAD_EAT_FILE = PATH + "sfx - undead eat"; 18 | public const string UNDEAD_RISE = "undead rise"; 19 | public const string UNDEAD_RISE_FILE = PATH + "sfx - undead rise"; 20 | public const string NIGHTMARE = "nightmare"; 21 | public const string NIGHTMARE_FILE = PATH + "sfx - nightmare"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/ActorCourage.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.ActorCourage 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Data 10 | { 11 | [Serializable] 12 | public enum ActorCourage 13 | { 14 | COWARD, 15 | CAUTIOUS, 16 | COURAGEOUS, 17 | } 18 | 19 | internal static class ActorCourage_ext 20 | { 21 | internal static string to_s(this ActorCourage c) 22 | { 23 | switch (c) { 24 | case ActorCourage.COWARD: return "Coward"; 25 | case ActorCourage.CAUTIOUS: return "Cautious"; 26 | case ActorCourage.COURAGEOUS: return "Courageous"; 27 | default: throw new ArgumentOutOfRangeException("unhandled courage"); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemWeapon.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemWeapon 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Items 13 | { 14 | [Serializable] 15 | public abstract class ItemWeapon : Item 16 | { 17 | new public ItemWeaponModel Model { get {return (base.Model as ItemWeaponModel)!; } } 18 | protected ItemWeapon(ItemWeaponModel model) : base(model) {} 19 | protected ItemWeapon(ItemWeaponModel model, int qty) : base(model, qty) {} 20 | 21 | #region implement Zaimoni.Serialization.ISerialize 22 | protected ItemWeapon(Zaimoni.Serialization.DecodeObjects decode) : base(decode) {} 23 | #endregion 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/UntypedCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Zaimoni.Data 5 | { 6 | [Serializable] 7 | class UntypedCache 8 | { 9 | private Dictionary _map = null; 10 | 11 | // Create Read Update Delete API 12 | public bool Has(K key) { return _map?.ContainsKey(key) ?? false; } 13 | public T Get(K key) { 14 | if (null == _map) return default; 15 | if (!_map.TryGetValue(key, out var test)) return default; 16 | if (test is T ret) return ret; 17 | return default; 18 | } 19 | 20 | public void Unset(K key) { 21 | if (null != _map) { 22 | _map.Remove(key); 23 | if (0 >= _map.Count) _map = null; 24 | } 25 | } 26 | 27 | public void Set(K key, object val) { 28 | (_map ??= new Dictionary())[key] = val; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_RangedWeapons.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","ATK","DMG","RANGE","MAXAMMO","FLAVOR" 2 | "RANGED_ARMY_PISTOL","army pistol","army pistols",24,12,6,24,6,12,"Bang bang!" 3 | "RANGED_ARMY_RIFLE","army rifle","army rifles",30,15,7,40,8,10,"Aim. Shoot. Kill." 4 | "RANGED_HUNTING_CROSSBOW","hunting crossbow","hunting crossbows",20,10,5,16,5,20,"Aim between the eyes." 5 | "RANGED_HUNTING_RIFLE","hunting rifle","hunting rifles",30,15,10,24,8,7,"Good hunting!" 6 | "RANGED_PISTOL","pistol","pistols",20,18,16,20,6,10,"Bang!" 7 | "RANGED_KOLT_REVOLVER","Kolt revolver","Kolt revolvers",20,10,5,24,6,6,"K for Kolt." 8 | "RANGED_PRECISION_RIFLE","precision rifle","precision rifles",80,10,5,20,8,2,"Precise death." 9 | "RANGED_SHOTGUN","shotgun","shotguns",60,40,15,30,3,5,"Devastating at close range." 10 | "UNIQUE_SANTAMAN_SHOTGUN","Santaman shotgun","Santaman shotgun",60,40,15,30,4,5,"Merry Shotmas!" 11 | "UNIQUE_HANS_VON_HANZ_PISTOL","Hans von Hanz pistol","Hans von Hanz pistol",40,30,20,22,6,14,"Feuer!" -------------------------------------------------------------------------------- /RogueSurvivor/Data/Weather.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.Weather 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Data 10 | { 11 | // VAPORWARE while currently this is a single value at the World level, it logically should be per-district to allow 12 | // for fronts, etc. (also want to adjust sunrise/sunset times by longitude/latitude) 13 | 14 | [Serializable] 15 | public enum Weather 16 | { 17 | CLEAR = 0, 18 | CLOUDY = 1, 19 | RAIN = 2, 20 | HEAVY_RAIN = 3, 21 | _COUNT = 4, 22 | } 23 | 24 | public static class WeatherExtension 25 | { 26 | internal static bool IsRain(this Weather w) 27 | { 28 | return Weather.RAIN==w || Weather.HEAVY_RAIN==w; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionShout.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionShout 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Actions 12 | { 13 | public sealed class ActionShout : ActorAction 14 | { 15 | private readonly string? m_Text; 16 | 17 | public ActionShout(Actor actor, string? text = null) : base(actor) 18 | { 19 | m_Text = text; 20 | actor.Activity = Activity.IDLE; 21 | } 22 | 23 | public override bool IsLegal() 24 | { 25 | return m_Actor.CanShout(out m_FailReason); 26 | } 27 | 28 | public override void Perform() 29 | { 30 | RogueGame.Game.DoShout(m_Actor, m_Text); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/CSVField.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.CSVField 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine 12 | { 13 | public class CSVField 14 | { 15 | private readonly string m_RawString; 16 | 17 | public CSVField(string rawString) 18 | { 19 | m_RawString = rawString 20 | #if DEBUG 21 | ?? throw new ArgumentNullException(nameof(rawString)) 22 | #endif 23 | ; 24 | } 25 | 26 | public int ParseInt() { return int.Parse(m_RawString); } 27 | public float ParseFloat() { return float.Parse(m_RawString); } 28 | public string ParseText() { return m_RawString.Trim('"'); } 29 | public bool ParseBool() { return ParseInt() > 0; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionUnequipItem.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionUnequipItem 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | internal class ActionUnequipItem : ActorAction 13 | { 14 | private readonly Item m_Item; 15 | 16 | public ActionUnequipItem(Actor actor, Item it) : base(actor) 17 | { 18 | m_Item = it 19 | #if DEBUG 20 | ?? throw new ArgumentNullException(nameof(it)) 21 | #endif 22 | ; 23 | } 24 | 25 | public override bool IsLegal() 26 | { 27 | return m_Actor.CanUnequip(m_Item, out m_FailReason); 28 | } 29 | 30 | public override void Perform() { m_Item.UnequippedBy(m_Actor); } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionChat.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionChat 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Actions 12 | { 13 | internal class ActionChat : ActorAction 14 | { 15 | private readonly Actor m_Target; 16 | 17 | public Actor Target { get { return m_Target; } } 18 | 19 | public ActionChat(Actor actor, Actor target) : base(actor) 20 | { 21 | m_Target = target; 22 | } 23 | 24 | public override bool IsLegal() 25 | { 26 | return m_Actor.CanChatWith(m_Target,out m_FailReason); 27 | } 28 | 29 | public override void Perform() 30 | { 31 | RogueGame.Game.DoChat(m_Actor, m_Target); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RogueSurvivor/UI/Message.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.Message 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using Zaimoni.Data; 9 | 10 | using Color = System.Drawing.Color; 11 | 12 | #nullable enable 13 | 14 | namespace djack.RogueSurvivor.UI 15 | { 16 | [Serializable] 17 | public class Message 18 | { 19 | public readonly string Text; 20 | public readonly Color Color; 21 | public readonly int Turn; 22 | 23 | public Message(string text, int turn, Color color) 24 | { 25 | #if DEBUG 26 | if (string.IsNullOrEmpty(text)) throw new ArgumentNullException(nameof(text)); 27 | #endif 28 | Text = turn.ToString()+" "+text.Capitalize(); 29 | Color = color; 30 | Turn = turn; 31 | } 32 | 33 | public Message(string text, int turn) : this(text, turn, Color.White) {} 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemWeaponModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemWeaponModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | public abstract class ItemWeaponModel : Data.Model.Item 14 | { 15 | private readonly Attack m_Attack; 16 | 17 | public Attack Attack { get { return m_Attack; } } // need value copy here for safety 18 | 19 | protected ItemWeaponModel(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, Attack attack, string flavor, bool is_artifact) 20 | : base(_id, aName, theNames, imageID, flavor, DollPart.RIGHT_HAND) 21 | { 22 | m_Attack = attack; 23 | if (is_artifact) IsUnbreakable = true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Verb.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.Verb 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Data 12 | { 13 | [Serializable] 14 | sealed public class Verb 15 | { 16 | public readonly string YouForm; // 2nd person singular; in English typically also 3rd person plural 17 | public readonly string HeForm; // 3rd person singular 18 | 19 | public Verb(string youForm, string heForm) 20 | { 21 | YouForm = youForm; 22 | HeForm = heForm; 23 | } 24 | 25 | public Verb(string youForm) : this(youForm, youForm + "s") {} 26 | 27 | public string Conjugate(int person, int qty = 1) 28 | { 29 | if (3 == person && 1 == qty) return HeForm; 30 | return YouForm; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/OutTextFile.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Zaimoni.Data 4 | { 5 | public class OutTextFile 6 | { 7 | public readonly string filepath; 8 | private StreamWriter _file; 9 | 10 | public OutTextFile(string dest) { 11 | filepath = dest; 12 | } 13 | 14 | public void WriteLine(string src) { 15 | lock (this) { 16 | if (null == _file) { 17 | if (File.Exists(filepath)) File.Delete(filepath); 18 | _file = File.CreateText(filepath); 19 | } 20 | _file.WriteLine(src); 21 | _file.Flush(); 22 | } 23 | } 24 | 25 | public void Close() { // XXX C# goes inefficient with a true destructor so don't provide one 26 | lock (this) { 27 | if (null != _file) { 28 | _file.Close(); 29 | _file = null; 30 | } 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemGrenade.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemGrenade 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | [Serializable] 14 | public sealed class ItemGrenade : ItemExplosive, Zaimoni.Serialization.ISerialize 15 | { 16 | new public Data.Model.Explosive Model { get {return (base.Model as Data.Model.Explosive)!; } } 17 | public ItemGrenade(Data.Model.Explosive model, int qty=1) : base(model, qty) {} 18 | 19 | #region implement Zaimoni.Serialization.ISerialize 20 | protected ItemGrenade(Zaimoni.Serialization.DecodeObjects decode) : base(decode) {} 21 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) => base.save(encode); 22 | #endregion 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionEatFoodOnGround.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionEatFoodOnGround 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using djack.RogueSurvivor.Engine.Items; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Actions 13 | { 14 | internal class ActionEatFoodOnGround : ActorAction 15 | { 16 | private readonly ItemFood m_Item; 17 | 18 | public ActionEatFoodOnGround(Actor actor, ItemFood it) : base(actor) 19 | { 20 | m_Item = it; 21 | } 22 | 23 | public override bool IsLegal() 24 | { 25 | return Rules.CanActorEatFoodOnGround(m_Actor, m_Item, out m_FailReason); 26 | } 27 | 28 | public override void Perform() 29 | { 30 | m_Item.Use(m_Actor, m_Actor.Location.Items!); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemAmmoModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemAmmoModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | public sealed class ItemAmmoModel : Data.Model.Item 14 | { 15 | public readonly AmmoType AmmoType; 16 | 17 | public int MaxQuantity { get { return StackingLimit; } } 18 | 19 | public ItemAmmoModel(Gameplay.Item_IDs _id, string imageID, AmmoType ammoType, int maxQuantity) 20 | : base(_id, ammoType.Describe(), ammoType.Describe(true), imageID) 21 | { 22 | AmmoType = ammoType; 23 | StackingLimit = maxQuantity; 24 | } 25 | 26 | public override ItemAmmo create() => new(this); 27 | public override ItemAmmo from(in Item_s src) => new(this, src.QtyLike); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemExplosive.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemExplosive 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Items 13 | { 14 | [Serializable] 15 | public abstract class ItemExplosive : Item 16 | { 17 | new public Data.Model.Explosive Model { get {return (base.Model as Data.Model.Explosive)!; } } 18 | 19 | public ItemExplosive(Data.Model.Explosive model, int qty=1) : base(model, qty) {} 20 | 21 | #region implement Zaimoni.Serialization.ISerialize 22 | protected ItemExplosive(Zaimoni.Serialization.DecodeObjects decode) : base(decode) {} 23 | 24 | new protected void save(Zaimoni.Serialization.EncodeObjects encode) { 25 | base.save(encode); 26 | } 27 | #endregion 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemGrenadePrimed.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemGrenadePrimed 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | [Serializable] 14 | public sealed class ItemGrenadePrimed : ItemPrimedExplosive, Zaimoni.Serialization.ISerialize 15 | { 16 | public ItemGrenadePrimed(Data.Model.Explosive model) : base(model) {} 17 | public ItemGrenadePrimed(Data.Model.Explosive model, int fuse_left) : base(model, fuse_left) {} 18 | 19 | 20 | #region implement Zaimoni.Serialization.ISerialize 21 | protected ItemGrenadePrimed(Zaimoni.Serialization.DecodeObjects decode) : base(decode) {} 22 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) => base.save(encode); 23 | #endregion 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionEquipItem.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionEquipItem 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | internal class ActionEquipItem : ActorAction 13 | { 14 | private readonly Item m_Item; 15 | 16 | public ActionEquipItem(Actor actor, Item it) : base(actor) 17 | { 18 | m_Item = it 19 | #if DEBUG 20 | ?? throw new ArgumentNullException(nameof(it)) 21 | #endif 22 | ; 23 | } 24 | 25 | public override bool IsLegal() 26 | { 27 | return m_Actor.CanEquip(m_Item, out m_FailReason); 28 | } 29 | 30 | public override void Perform() { m_Item.EquippedBy(m_Actor); } 31 | 32 | public override string ToString() 33 | { 34 | return m_Actor.Name+" equips "+m_Item; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/UniqueItems.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.UniqueItems 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Engine 10 | { 11 | [Serializable] 12 | public class UniqueItems : Zaimoni.Serialization.ISerialize 13 | { 14 | public UniqueItem TheSubwayWorkerBadge = default; 15 | 16 | public UniqueItems() {} 17 | 18 | #region implement Zaimoni.Serialization.ISerialize 19 | protected UniqueItems(Zaimoni.Serialization.DecodeObjects decode) { 20 | Zaimoni.Serialization.ISave.Load(decode, ref TheSubwayWorkerBadge, (it,spawned) => { 21 | TheSubwayWorkerBadge = new(it, spawned); 22 | }); 23 | } 24 | 25 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) { 26 | Zaimoni.Serialization.ISave.Save(encode, in TheSubwayWorkerBadge); 27 | } 28 | #endregion 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionTrade.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionTrade 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | [Serializable] 13 | internal class ActionTrade : ActorAction 14 | { 15 | private readonly Actor m_Target; 16 | 17 | public ActionTrade(Actor actor, Actor target) : base(actor) 18 | { 19 | m_Target = target 20 | #if DEBUG 21 | ?? throw new ArgumentNullException(nameof(target)) 22 | #endif 23 | ; 24 | } 25 | 26 | public override bool IsLegal() 27 | { 28 | return m_Actor.CanTradeWith(m_Target); 29 | } 30 | 31 | public override void Perform() 32 | { 33 | RogueGame.Game.DoTrade(m_Actor.Controller as Gameplay.AI.OrderableAI, m_Target.Controller as Gameplay.AI.OrderableAI); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionSay.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionSay 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | public sealed class ActionSay : ActorAction 13 | { 14 | private readonly Actor m_Target; 15 | private readonly string m_Text; 16 | private readonly Sayflags m_Flags; 17 | 18 | public ActionSay(Actor actor, Actor target, string text, Sayflags flags) : base(actor) 19 | { 20 | m_Target = target 21 | #if DEBUG 22 | ?? throw new ArgumentNullException(nameof(target)) 23 | #endif 24 | ; 25 | m_Text = text; 26 | m_Flags = flags; 27 | } 28 | 29 | public override bool IsLegal() 30 | { 31 | return true; 32 | } 33 | 34 | public override void Perform() => m_Actor.Say(m_Target, m_Text, m_Flags); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Skills.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","VALUE1","VALUE2","VALUE3","VALUE4" 2 | "AGILE","Agile",2,4,0,0 3 | "AWAKE","Awake",0.10,0.17,0,0 4 | "BOWS","Bows",10,4,0,0 5 | "CARPENTRY","Carpentry",0.15,1,0,0 6 | "CHARISMATIC","Charismatic",2,10,0,0 7 | "FIREARMS","Firearms",10,2,0,0 8 | "HARDY","Hardy",1,0,0,0 9 | "HAULER","Hauler",1,0,0,0 10 | "HIGH_STAMINA","High Stamina",8,0,0,0 11 | "LEADERSHIP","Leadership",1,0,0,0 12 | "LIGHT_EATER","Light Eater",0.15,0.10,0,0 13 | "LIGHT_FEET","Light Feet",15,0,0,0 14 | "LIGHT_SLEEPER","Light Sleeper",20,0,0,0 15 | "MARTIAL_ARTS","Martial Arts",6,2,0,0 16 | "MEDIC","Medic",0.15,10,0,0 17 | "NECROLOGY","Necrology",2,4,0,0 18 | "STRONG","Strong",3,1,0,0 19 | "STRONG_PSYCHE","Strong Psyche",0.15,0.15,0,0 20 | "TOUGH","Tough",6,0,0,0 21 | "UNSUSPICIOUS","Unsuspicious",20,0,0,0 22 | "Z_AGILE","Z-Agile",1,2,0,0 23 | "Z_EATER","Z-Eater",0.15,0,0,0 24 | "Z_GRAB","Z-Grab",4,0,0,0 25 | "Z_INFECTOR","Z-Infector",0.15,0,0,0 26 | "Z_LIGHT_EATER","Z-Light Eater",0.15,0.10,0,0 27 | "Z_LIGHT_FEET","Z-Light Feet",3,0,0,0 28 | "Z_STRONG","Z-Strong",2,0,0,0 29 | "Z_TOUGH","Z-Tough",3,0,0,0 30 | "Z_TRACKER","Z-Tracker",0.04,0,0,0 31 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Model/BodyArmor.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace djack.RogueSurvivor.Data.Model 4 | { 5 | public sealed class BodyArmor : Item 6 | { 7 | public readonly int Protection_Hit; 8 | public readonly int Protection_Shot; 9 | public readonly int Encumbrance; 10 | public readonly int Weight; 11 | 12 | public BodyArmor(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, int protection_hit, int protection_shot, int encumbrance, int weight, string flavor) 13 | : base(_id, aName, theNames, imageID, flavor, DollPart.TORSO) 14 | { 15 | Protection_Hit = protection_hit; 16 | Protection_Shot = protection_shot; 17 | Encumbrance = encumbrance; 18 | Weight = weight; 19 | } 20 | 21 | public Defence ToDefence() => new Defence(-Encumbrance, Protection_Hit, Protection_Shot); 22 | public int Rating { get => Protection_Hit + Protection_Shot; } 23 | 24 | public override Engine.Items.ItemBodyArmor create() => new(this); 25 | public override Engine.Items.ItemBodyArmor from(in Item_s src) => new(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemBarricadeMaterial.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemBarricadeMaterial 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Items 13 | { 14 | [Serializable] 15 | public sealed class ItemBarricadeMaterial : Item, Zaimoni.Serialization.ISerialize 16 | { 17 | new public ItemBarricadeMaterialModel Model { get {return (base.Model as ItemBarricadeMaterialModel)!; } } 18 | 19 | public ItemBarricadeMaterial(ItemBarricadeMaterialModel model, int qty=1) : base(model, qty) {} 20 | 21 | #region implement Zaimoni.Serialization.ISerialize 22 | protected ItemBarricadeMaterial(Zaimoni.Serialization.DecodeObjects decode) : base(decode) {} 23 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) => base.save(encode); 24 | #endregion 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /RogueSurvivor/Gameplay/AI/Goals/StageAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using djack.RogueSurvivor.Data; 3 | 4 | namespace djack.RogueSurvivor.Gameplay.AI.Goals 5 | { 6 | [Serializable] 7 | internal class StageAction : Objective 8 | { 9 | public readonly ActorAction Intent; 10 | 11 | public StageAction(int t0, Actor who, ActorAction free_act) : base(t0,who) 12 | { 13 | #if DEBUG 14 | if (!(who.Controller is ObjectiveAI)) throw new ArgumentOutOfRangeException(nameof(who), who, "not intelligent enough to plan ahead"); 15 | #endif 16 | Intent = free_act; 17 | } 18 | 19 | // always execute. Expire on execution 20 | public override bool UrgentAction(out ActorAction ret) 21 | { 22 | ret = null; 23 | if (Intent.IsPerformable() && !Intent.Abort()) { 24 | // XXX need some sense of what a combat action is 25 | var ai = m_Actor.Controller; 26 | if (null != ai.enemies_in_FOV) return false; 27 | 28 | var oai = (ai as ObjectiveAI)!; 29 | if (!oai.VetoAction(Intent)) oai.Stage(Intent); 30 | } 31 | _isExpired = true; 32 | return true; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/UniqueActor.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.UniqueActor 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | namespace djack.RogueSurvivor.Engine 11 | { 12 | [Serializable] 13 | public class UniqueActor 14 | { 15 | private bool m_Spawned; 16 | public readonly Actor TheActor; 17 | public readonly bool IsWithRefugees; 18 | public readonly string EventThemeMusic; 19 | public readonly string EventMessage; 20 | 21 | public bool IsSpawned { 22 | get { return m_Spawned; } 23 | set { if (!m_Spawned) m_Spawned = value; } // \todo? eliminate this outright 24 | } 25 | 26 | public UniqueActor(Actor a, bool spawn_now, bool refugee=false, string music=null, string msg=null) 27 | { 28 | m_Spawned = spawn_now; 29 | TheActor = a; 30 | IsWithRefugees = refugee; 31 | EventThemeMusic = music; 32 | EventMessage = msg; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionDropItem.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionDropItem 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using djack.RogueSurvivor.Data; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | [Serializable] 13 | internal class ActionDropItem : ActorAction,ActorGive 14 | { 15 | private readonly Item m_Item; 16 | 17 | public Item Give { get { return m_Item; } } 18 | 19 | public ActionDropItem(Actor actor, Item it) : base(actor) 20 | { 21 | m_Item = it 22 | #if DEBUG 23 | ?? throw new ArgumentNullException(nameof(it)) 24 | #endif 25 | ; 26 | actor.Activity = Activity.IDLE; 27 | } 28 | 29 | public override bool IsLegal() 30 | { 31 | return m_Actor.CanDrop(m_Item, out m_FailReason); 32 | } 33 | 34 | public override void Perform() 35 | { 36 | RogueGame.Game.DoDropItem(m_Actor, m_Item); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Model/Explosive.cs: -------------------------------------------------------------------------------- 1 | using djack.RogueSurvivor.Engine.Items; 2 | 3 | namespace djack.RogueSurvivor.Data.Model 4 | { 5 | public class Explosive : Item 6 | { 7 | public readonly int FuseDelay; 8 | private readonly BlastAttack m_Attack; 9 | public readonly PrimedExplosive Primed; 10 | public readonly int MaxThrowDistance; 11 | 12 | public ref readonly BlastAttack BlastAttack { get { return ref m_Attack; } } 13 | 14 | public Explosive(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, int fuseDelay, BlastAttack attack, string flavor, PrimedExplosive primed, int maxThrow, int stackingLimit) 15 | : base(_id, aName, theNames, imageID, flavor, DollPart.RIGHT_HAND) 16 | { 17 | FuseDelay = fuseDelay; 18 | m_Attack = attack; 19 | Primed = primed; 20 | MaxThrowDistance = maxThrow; 21 | StackingLimit = stackingLimit; 22 | } 23 | 24 | // formally incorrect, but we only have grenades 25 | public override ItemGrenade create() => new ItemGrenade(this); 26 | public override ItemGrenade from(in Item_s src) => new(this, src.QtyLike); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemEntertainmentModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemEntertainmentModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | public class ItemEntertainmentModel : Data.Model.Item 14 | { 15 | public readonly int Value; 16 | public readonly int BoreChance; 17 | 18 | public ItemEntertainmentModel(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, int value, int boreChance, int stacking, string flavor) 19 | : base(_id, aName, theNames, imageID, flavor) 20 | { 21 | Value = value; 22 | BoreChance = boreChance; 23 | StackingLimit = stacking; 24 | } 25 | 26 | public override ItemEntertainment create() => new(this); 27 | public ItemEntertainment instantiate() => new(this); 28 | public override ItemEntertainment from(in Item_s src) => new(this, src.QtyLike); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemSprayScentModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemSprayScentModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | public sealed class ItemSprayScentModel : Data.Model.Item 14 | { 15 | public readonly int MaxSprayQuantity; 16 | public readonly Odor Odor; 17 | public readonly int Strength; 18 | 19 | public ItemSprayScentModel(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, int sprayQuantity, Odor odor, int strength, string flavor) 20 | : base(_id, aName, theNames, imageID, flavor, DollPart.LEFT_HAND) 21 | { 22 | MaxSprayQuantity = sprayQuantity; 23 | Odor = odor; 24 | Strength = strength; 25 | } 26 | 27 | public override ItemSprayScent create() => new(this); 28 | public override ItemSprayScent from(in Item_s src) => new(this, src.QtyLike); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemBarricadeMaterialModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemBarricadeMaterialModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | public sealed class ItemBarricadeMaterialModel : Data.Model.Item 14 | { 15 | public readonly int BarricadingValue; 16 | 17 | public ItemBarricadeMaterialModel(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, int barricadingValue, int stackingLimit, string flavor) 18 | : base(_id, aName, theNames, imageID, flavor) 19 | { 20 | BarricadingValue = barricadingValue; 21 | StackingLimit = stackingLimit; 22 | } 23 | 24 | public override ItemBarricadeMaterial create() => new(this); 25 | public ItemBarricadeMaterial instantiate(int qty=1) => new(this, qty); 26 | public override ItemBarricadeMaterial from(in Item_s src) => new(this, src.QtyLike); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemMeleeWeapon.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemMeleeWeapon 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | [Serializable] 14 | public sealed class ItemMeleeWeapon : ItemWeapon, Zaimoni.Serialization.ISerialize 15 | { 16 | new public ItemMeleeWeaponModel Model { get {return (base.Model as ItemMeleeWeaponModel)!; } } 17 | public bool IsFragile { get { return Model.IsFragile; } } 18 | 19 | public ItemMeleeWeapon(ItemMeleeWeaponModel model) : base(model) { } 20 | public ItemMeleeWeapon(ItemMeleeWeaponModel model, int qty) : base(model, qty) { } 21 | 22 | #region implement Zaimoni.Serialization.ISerialize 23 | protected ItemMeleeWeapon(Zaimoni.Serialization.DecodeObjects decode) : base(decode) {} 24 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) => base.save(encode); 25 | #endregion 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/MapObjects/Board.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.MapObjects.Board 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.MapObjects 13 | { 14 | [Serializable] 15 | internal sealed class Board : MapObject, Zaimoni.Serialization.ISerialize 16 | { 17 | public readonly string[] Text; 18 | 19 | public Board(string imageID, string[] text) : base(imageID) { 20 | Text = text; 21 | } 22 | 23 | #region implement Zaimoni.Serialization.ISerialize 24 | protected Board(Zaimoni.Serialization.DecodeObjects decode) : base(decode) { 25 | Zaimoni.Serialization.ISave.LinearLoad(decode, out Text); 26 | } 27 | 28 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) { 29 | base.save(encode); 30 | Zaimoni.Serialization.ISave.LinearSave(encode, Text); 31 | } 32 | #endregion 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/ActorDirective.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.ActorDirective 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Data 10 | { 11 | // This is set *only* by the player; a total replacement with the objectives system is anticipated. 12 | [Serializable] 13 | public class ActorDirective 14 | { 15 | public const bool CanFireWeapons_default = true; 16 | public const bool CanThrowGrenades_default = true; 17 | public const bool CanSleep_default = true; 18 | public const bool CanTrade_default = true; 19 | public const ActorCourage Courage_default = ActorCourage.CAUTIOUS; 20 | 21 | public bool CanFireWeapons = CanFireWeapons_default; 22 | public bool CanThrowGrenades = CanThrowGrenades_default; 23 | public bool CanSleep = CanSleep_default; // may want this indefinitely (useful to disable when appointing guards) 24 | public bool CanTrade = CanTrade_default; 25 | public ActorCourage Courage = Courage_default; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemSprayPaintModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemSprayPaintModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Items 13 | { 14 | internal sealed class ItemSprayPaintModel : Data.Model.Item 15 | { 16 | public readonly int MaxPaintQuantity; 17 | public readonly string TagImageID; 18 | 19 | public ItemSprayPaintModel(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, int paintQuantity, string tagImageID, string flavor) 20 | : base(_id, aName, theNames, imageID, flavor, DollPart.LEFT_HAND) 21 | { 22 | #if DEBUG 23 | if (string.IsNullOrEmpty(tagImageID)) throw new ArgumentNullException(nameof(tagImageID)); 24 | #endif 25 | MaxPaintQuantity = paintQuantity; 26 | TagImageID = tagImageID; 27 | } 28 | 29 | public override ItemSprayPaint create() => new(this); 30 | public override ItemSprayPaint from(in Item_s src) => new(this, src.QtyLike); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionMeleeAttack.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionMeleeAttack 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | using djack.RogueSurvivor.Data; 10 | 11 | #nullable enable 12 | 13 | namespace djack.RogueSurvivor.Engine.Actions 14 | { 15 | public interface CombatAction 16 | { 17 | Actor target { get; } // of m_Actor 18 | } 19 | 20 | [Serializable] 21 | public sealed class ActionMeleeAttack : ActorAction, CombatAction 22 | { 23 | private readonly Actor m_Target; 24 | 25 | public ActionMeleeAttack(Actor actor, Actor target) : base(actor) 26 | { 27 | m_Target = target; 28 | actor.Activity = Activity.IDLE; // transition to fighting is in DoMeleeAttack 29 | } 30 | 31 | public Actor target { get { return m_Target; } } 32 | 33 | public override bool IsLegal() 34 | { 35 | return m_Actor.CanMeleeAttack(m_Target); 36 | } 37 | 38 | public override void Perform() 39 | { 40 | RogueGame.Game.DoMeleeAttack(m_Actor, m_Target); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionSwitchPowerGenerator.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionSwitchPowerGenerator 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using djack.RogueSurvivor.Engine.MapObjects; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Actions 13 | { 14 | public sealed class ActionSwitchPowerGenerator : ActorAction 15 | { 16 | private readonly PowerGenerator m_PowGen; 17 | 18 | public ActionSwitchPowerGenerator(Actor actor, PowerGenerator powGen) 19 | : base(actor) 20 | { 21 | m_PowGen = powGen; 22 | } 23 | 24 | public override bool IsLegal() 25 | { 26 | return m_Actor.CanSwitch(m_PowGen, out m_FailReason); 27 | } 28 | 29 | public override bool IsPerformable() 30 | { 31 | if (!base.IsPerformable()) return false; 32 | return 1==Rules.GridDistance(m_Actor.Location, m_PowGen.Location); 33 | } 34 | 35 | public override void Perform() 36 | { 37 | RogueGame.Game.DoSwitchPowerGenerator(m_Actor, m_PowGen); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Item/PrimedExplosive.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace djack.RogueSurvivor.Data._Item 5 | { 6 | [Serializable] 7 | public sealed class PrimedExplosive : Engine.Items.ItemExplosive 8 | { 9 | private int m_FuseTimeLeft; 10 | 11 | public int FuseTimeLeft { get { return m_FuseTimeLeft; } } 12 | 13 | public new Data.Model.PrimedExplosive Model { get { return base.Model.Primed; } } 14 | public Data.Model.Explosive Unprimed { get { return base.Model; } } 15 | 16 | public PrimedExplosive(Data.Model.Explosive model, int fuse_left) : base(model) { 17 | m_FuseTimeLeft = fuse_left; 18 | } 19 | public PrimedExplosive(Data.Model.Explosive model) : this(model, model.FuseDelay) { } 20 | 21 | public override string ImageID { 22 | get { 23 | return base.Model.Primed.ImageID; 24 | } 25 | } 26 | 27 | 28 | public void Cook() { Interlocked.Exchange(ref m_FuseTimeLeft, 0); } // detonate immediately 29 | public bool Expire() { return 0 >= Interlocked.Decrement(ref m_FuseTimeLeft); } 30 | static public bool IsExpired(PrimedExplosive e) { return 0 >= e.m_FuseTimeLeft; } 31 | public override Data.Item_s toStruct() { return new Data.Item_s(ModelID, m_FuseTimeLeft); } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionOpenDoor.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionOpenDoor 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using djack.RogueSurvivor.Engine.MapObjects; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | internal class ActionOpenDoor : ActorAction 13 | { 14 | private readonly DoorWindow m_Door; 15 | 16 | public DoorWindow door { get { return m_Door; } } 17 | 18 | public ActionOpenDoor(Actor actor, DoorWindow door) : base(actor) 19 | { 20 | m_Door = door; 21 | } 22 | 23 | public override bool IsLegal() 24 | { 25 | return m_Actor.CanOpen(m_Door, out m_FailReason); 26 | } 27 | 28 | // would need IsPerformable if could be saved to hard drive 29 | 30 | public override void Perform() 31 | { 32 | bool was_opaque = !m_Door.IsTransparent; 33 | m_Door.SetState(DoorWindow.STATE_OPEN); 34 | m_Actor.SpendActionPoints(); 35 | if (was_opaque) m_Actor.Controller.UpdateSensors(); 36 | RogueGame.Game.UI_OpenDoor(m_Actor, m_Door); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /RogueSurvivor/Gameplay/GameGangs.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Gameplay.GameGangs 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Gameplay 10 | { 11 | public static class GameGangs 12 | { 13 | private const int MAX_GANGS = (int)IDs.GANGSTA_FLOODS+1; 14 | 15 | public static readonly IDs[] GANGSTAS = new IDs[2] 16 | { 17 | IDs.GANGSTA_CRAPS, 18 | IDs.GANGSTA_FLOODS 19 | }; 20 | public static readonly GameGangs.IDs[] BIKERS = new IDs[2] 21 | { 22 | IDs.BIKER_HELLS_SOULS, 23 | IDs.BIKER_FREE_ANGELS 24 | }; 25 | private static readonly string[] NAMES = new string[MAX_GANGS] { 26 | "(no gang)", 27 | "Hell's Souls", 28 | "Free Angels", 29 | "Craps", 30 | "Floods" 31 | }; 32 | 33 | public static string Name(this IDs x) 34 | { 35 | return NAMES[(int)x]; 36 | } 37 | 38 | [Serializable] 39 | public enum IDs 40 | { 41 | NONE, 42 | BIKER_HELLS_SOULS, 43 | BIKER_FREE_ANGELS, 44 | GANGSTA_CRAPS, 45 | GANGSTA_FLOODS, 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/MapObjects/Fortification.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.MapObjects.Fortification 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.MapObjects 13 | { 14 | [Serializable] 15 | public sealed class Fortification : MapObject, Zaimoni.Serialization.ISerialize 16 | { 17 | public const int SMALL_BASE_HITPOINTS = DoorWindow.BASE_HITPOINTS/2; 18 | public const int LARGE_BASE_HITPOINTS = DoorWindow.BASE_HITPOINTS; 19 | 20 | #if OBSOLETE 21 | public Fortification(string imageID) : base(imageID, Fire.BURNABLE) {} 22 | #endif 23 | public Fortification(bool isLarge) : base(isLarge ? Gameplay.GameImages.OBJ_LARGE_WOODEN_FORTIFICATION : Gameplay.GameImages.OBJ_SMALL_WOODEN_FORTIFICATION, Fire.BURNABLE) {} 24 | 25 | #region implement Zaimoni.Serialization.ISerialize 26 | protected Fortification(Zaimoni.Serialization.DecodeObjects decode) : base(decode) {} 27 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) => base.save(encode); 28 | #endregion 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Defence.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.Defence 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Data 10 | { 11 | [Serializable] 12 | public readonly struct Defence 13 | { 14 | [NonSerialized] 15 | public static readonly Defence BLANK = new Defence(0, 0, 0); 16 | 17 | public readonly int Value; 18 | public readonly int Protection_Hit; 19 | public readonly int Protection_Shot; 20 | 21 | public Defence(int value, int protection_hit, int protection_shot) 22 | { 23 | Value = value; 24 | Protection_Hit = protection_hit; 25 | Protection_Shot = protection_shot; 26 | } 27 | 28 | public static Defence operator +(Defence lhs, Defence rhs) 29 | { 30 | return new Defence(lhs.Value + rhs.Value, lhs.Protection_Hit + rhs.Protection_Hit, lhs.Protection_Shot + rhs.Protection_Shot); 31 | } 32 | 33 | public static Defence operator -(Defence lhs, Defence rhs) 34 | { 35 | return new Defence(lhs.Value - rhs.Value, lhs.Protection_Hit - rhs.Protection_Hit, lhs.Protection_Shot - rhs.Protection_Shot); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionBarricadeDoor.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionBarricadeDoor 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using djack.RogueSurvivor.Engine.Items; 9 | using DoorWindow = djack.RogueSurvivor.Engine.MapObjects.DoorWindow; 10 | 11 | #nullable enable 12 | 13 | namespace djack.RogueSurvivor.Engine.Actions 14 | { 15 | internal class ActionBarricadeDoor : ActorAction,Target,Use 16 | { 17 | private readonly DoorWindow m_Door; 18 | 19 | public ActionBarricadeDoor(Actor actor, DoorWindow door) : base(actor) 20 | { 21 | m_Door = door; 22 | } 23 | 24 | public DoorWindow What { get { return m_Door; } } 25 | public ItemBarricadeMaterial Use { get { return m_Actor.Inventory?.GetSmallestStackOf()!; } } // assume legal/performable 26 | 27 | public override bool IsLegal() 28 | { 29 | return m_Actor.CanBarricade(m_Door, out m_FailReason); 30 | } 31 | 32 | public override void Perform() 33 | { 34 | RogueGame.Game.DoBarricadeDoor(m_Actor, m_Door); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionReviveCorpse.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionReviveCorpse 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using djack.RogueSurvivor.Engine.Items; 9 | using System; 10 | 11 | namespace djack.RogueSurvivor.Engine.Actions 12 | { 13 | internal class ActionReviveCorpse : ActorAction,TargetCorpse,Use 14 | { 15 | private readonly Corpse m_Target; 16 | 17 | public ActionReviveCorpse(Actor actor, Corpse target) : base(actor) 18 | { 19 | m_Target = target 20 | #if DEBUG 21 | ?? throw new ArgumentNullException(nameof(target)) 22 | #endif 23 | ; 24 | } 25 | 26 | public Corpse What { get { return m_Target; } } 27 | public ItemMedicine Use { get { return m_Actor.Inventory?.GetFirst(Gameplay.Item_IDs.MEDICINE_MEDIKIT) as ItemMedicine; } } // assume legal 28 | 29 | public override bool IsLegal() 30 | { 31 | return m_Actor.CanRevive(m_Target, out m_FailReason); 32 | } 33 | 34 | public override void Perform() 35 | { 36 | RogueGame.Game.DoReviveCorpse(m_Actor, m_Target); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Achievement.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Achievement 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | namespace djack.RogueSurvivor.Engine 8 | { 9 | public sealed class Achievement 10 | { 11 | public readonly IDs ID; 12 | public readonly string Name; 13 | public readonly string TeaseName; 14 | public readonly string[] Text; 15 | public readonly string MusicID; 16 | public readonly int ScoreValue; 17 | 18 | public Achievement(IDs id, string name, string teaseName, string[] text, string musicID, int scoreValue) 19 | { 20 | ID = id; 21 | Name = name; 22 | TeaseName = teaseName; 23 | Text = text; 24 | MusicID = musicID; 25 | ScoreValue = scoreValue; 26 | } 27 | 28 | public enum IDs 29 | { 30 | REACHED_DAY_07 = 0, 31 | REACHED_DAY_14 = 1, 32 | REACHED_DAY_21 = 2, 33 | REACHED_DAY_28 = 3, 34 | CHAR_BROKE_INTO_OFFICE = 4, 35 | CHAR_FOUND_UNDERGROUND_FACILITY = 5, 36 | CHAR_POWER_UNDERGROUND_FACILITY = 6, 37 | KILLED_THE_SEWERS_THING = 7, 38 | _COUNT = 8, 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionPutInContainer.cs: -------------------------------------------------------------------------------- 1 | using djack.RogueSurvivor.Data; 2 | 3 | #nullable enable 4 | 5 | namespace djack.RogueSurvivor.Engine.Actions 6 | { 7 | internal class ActionPutInContainer : ActorAction,ActorGive,Target 8 | { 9 | private readonly Item m_Item; 10 | private readonly ShelfLike m_Container; 11 | 12 | public Item Give { get { return m_Item; } } 13 | public MapObject What { get { return m_Container; } } 14 | 15 | public ActionPutInContainer(Actor actor, Item it, ShelfLike container) : base(actor) 16 | { 17 | m_Item = it; 18 | m_Container = container; 19 | actor.Activity = Activity.IDLE; 20 | } 21 | 22 | public override bool IsLegal() 23 | { 24 | m_FailReason = m_Container?.ReasonCantPutItemIn(m_Actor) ?? "object is not a container"; 25 | return string.IsNullOrEmpty(m_FailReason); 26 | } 27 | 28 | public override bool IsPerformable() 29 | { 30 | if (1 != Rules.InteractionDistance(m_Actor.Location, m_Container.Location)) return false; 31 | return base.IsPerformable(); 32 | } 33 | 34 | public override void Perform() 35 | { 36 | RogueGame.Game.DoPutItemInContainer(m_Actor, m_Container, m_Item); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionShove.cs: -------------------------------------------------------------------------------- 1 | using djack.RogueSurvivor.Data; 2 | using System; 3 | 4 | using Point = Zaimoni.Data.Vector2D; 5 | 6 | namespace djack.RogueSurvivor.Engine.Actions 7 | { 8 | internal class ActionShove : ActorAction, ActorDest 9 | { 10 | private readonly Actor m_Target; 11 | private readonly Direction m_Direction; 12 | private readonly Point m_To; 13 | 14 | public ActionShove(Actor actor, Actor target, Direction pushDir) : base(actor) 15 | { 16 | m_Target = target 17 | #if DEBUG 18 | ?? throw new ArgumentNullException(nameof(target)) 19 | #endif 20 | ; 21 | m_Direction = pushDir; 22 | m_To = target.Location.Position + pushDir; 23 | } 24 | 25 | public Actor Target { get { return m_Target; } } 26 | public Point To { get { return m_To; } } 27 | public Direction Dir { get { return m_Direction; } } 28 | public Location dest { get { return m_Target.Location; } } 29 | public Location a_dest { get { return new Location(m_Target.Location.Map,m_To); } } 30 | 31 | public override bool IsLegal() 32 | { 33 | if (m_Actor.CanShove(m_Target)) 34 | return m_Target.CanBeShovedTo(m_To, out m_FailReason); 35 | return false; 36 | } 37 | 38 | public override void Perform() 39 | { 40 | RogueGame.Game.DoShove(m_Actor, m_Target, a_dest); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemLightModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemLightModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using djack.RogueSurvivor.Data; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Items 13 | { 14 | public sealed class ItemLightModel : Data.Model.Item 15 | { 16 | public readonly int MaxBatteries; 17 | public readonly short FovBonus; 18 | public readonly string OutOfBatteriesImageID; 19 | 20 | public ItemLightModel(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, short fovBonus, int maxBatteries, string outOfBatteriesImageID, string flavor) 21 | : base(_id, aName, theNames, imageID, flavor, DollPart.LEFT_HAND, true) 22 | { 23 | #if DEBUG 24 | if (string.IsNullOrEmpty(outOfBatteriesImageID)) throw new ArgumentNullException(nameof(outOfBatteriesImageID)); 25 | #endif 26 | FovBonus = fovBonus; 27 | MaxBatteries = maxBatteries; 28 | OutOfBatteriesImageID = outOfBatteriesImageID; 29 | } 30 | 31 | public override ItemLight create() => new(this); 32 | public override ItemLight from(in Item_s src) => new(this, src.QtyLike); 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /RogueSurvivor/Gameplay/AI/Goals/Pathfinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using djack.RogueSurvivor.Data; 5 | 6 | namespace djack.RogueSurvivor.Gameplay.AI.Goals 7 | { 8 | public sealed class Pathfinder 9 | { 10 | private readonly LocationFunction[] m_GoalTypes; 11 | 12 | public Pathfinder(int n) { 13 | #if DEBUG 14 | if (0 >= n) throw new InvalidOperationException("backing array must be positive length"); 15 | #endif 16 | m_GoalTypes = new LocationFunction[n]; 17 | while(0 <= --n) m_GoalTypes[n] = new LocationFunction(); 18 | } 19 | 20 | #region forwarding to array interface 21 | public LocationFunction this[int n] { get { return m_GoalTypes[n]; } } 22 | public int Length { get { return m_GoalTypes.Length; } } 23 | #endregion 24 | 25 | public LocationFunction Goals() { 26 | int compare(int lhs, int rhs) { return lhs.CompareTo(rhs); } 27 | 28 | int ub = m_GoalTypes.Length; 29 | var ret = m_GoalTypes[--ub].ForwardingClone(); 30 | while(0 <= --ub) ret.ForwardingMerge(m_GoalTypes[ub], compare); 31 | return ret; 32 | } 33 | 34 | public void Remove(IEnumerable locs) { 35 | foreach (var x in m_GoalTypes) x.Remove(locs); 36 | } 37 | 38 | public void Remove(Location loc) { 39 | foreach (var x in m_GoalTypes) x.Remove(loc); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/TileModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.TileModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using Color = System.Drawing.Color; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Data 12 | { 13 | public sealed class TileModel 14 | { 15 | public static readonly TileModel UNDEF = new TileModel(GameTiles.IDs.UNDEF, "", Color.Pink, false, true); 16 | 17 | public readonly int ID; 18 | public readonly string ImageID; 19 | public readonly bool IsWalkable; 20 | public readonly bool IsTransparent; 21 | public readonly Color MinimapColor; 22 | public readonly bool IsWater; // 2020-05-09 should be ok to pay RAM for CPU here 23 | public readonly string? WaterCoverImageID; 24 | 25 | public TileModel(GameTiles.IDs id, string imageID, Color minimapColor, bool isWalkable, bool isTransparent, string? waterCoverImageID=null) 26 | { // the undef tile is empty-string imageID 27 | ID = (int)id; 28 | ImageID = imageID; 29 | IsWalkable = isWalkable; 30 | IsTransparent = isTransparent; 31 | MinimapColor = minimapColor; 32 | if (!string.IsNullOrEmpty(waterCoverImageID)) { 33 | IsWater = true; 34 | WaterCoverImageID = waterCoverImageID; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionTakeLead.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionTakeLead 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | using System.Linq; 10 | 11 | namespace djack.RogueSurvivor.Engine.Actions 12 | { 13 | internal class ActionTakeLead : ActorAction 14 | { 15 | private readonly Actor m_Target; 16 | 17 | public ActionTakeLead(Actor actor, Actor target) : base(actor) 18 | { 19 | m_Target = target 20 | #if DEBUG 21 | ?? throw new ArgumentNullException(nameof(target)) 22 | #endif 23 | ; 24 | actor.Activity = Activity.IDLE; 25 | } 26 | 27 | public override bool IsLegal() 28 | { 29 | return m_Actor.CanTakeLeadOf(m_Target); 30 | } 31 | 32 | public override bool IsPerformable() 33 | { 34 | if (!base.IsPerformable()) return false; 35 | return !m_Actor.Followers?.Contains(m_Target) ?? true; 36 | } 37 | 38 | public override void Perform() 39 | { 40 | RogueGame.Game.DoTakeLead(m_Actor, m_Target); 41 | } 42 | 43 | public override string ToString() 44 | { 45 | return m_Actor.Name + " trying to lead " + m_Target.Name + "; " + m_Actor.Location + ", " + m_Target.Location; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Goal/DeathTrapped.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using djack.RogueSurvivor.Data; 5 | using djack.RogueSurvivor.Gameplay.AI; 6 | 7 | #nullable enable 8 | 9 | namespace djack.RogueSurvivor.Engine.Goal 10 | { 11 | [Serializable] 12 | internal class DeathTrapped : Objective 13 | { 14 | private List banned; 15 | 16 | public DeathTrapped(Actor who, in Location ban) : base(who.Location.Map.LocalTime.TurnCounter, who) 17 | { 18 | banned = new() { ban }; 19 | } 20 | 21 | // Influence on pathfinding, so never returns an action 22 | public override bool UrgentAction(out ActorAction? ret) 23 | { 24 | ret = null; 25 | 26 | // Cf. Rules::IsPathableFor 27 | var ub = banned.Count; 28 | while (0 <= --ub) { 29 | if (1 < m_Actor.Controller.FastestTrapKill(banned[ub])) { 30 | banned.RemoveAt(ub); // no longer deathtrapped 31 | } 32 | } 33 | _isExpired = 0 >= banned.Count; 34 | return _isExpired; 35 | } 36 | 37 | /// true iff recorded 38 | public bool Ban(in Location ban) { 39 | var ret = !banned.Contains(ban); 40 | if (ret) banned.Add(ban); 41 | return ret; 42 | } 43 | 44 | public bool IsBanned(Location ban) { 45 | return banned.Contains(ban); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/BlastAttack.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.BlastAttack 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Data 12 | { 13 | public readonly struct BlastAttack 14 | { 15 | public readonly int Radius; 16 | public readonly int[] Damage; 17 | public readonly bool CanDamageObjects; 18 | public readonly bool CanDestroyWalls; // XXX not implemented, so hard-errors if true 19 | 20 | public BlastAttack(int radius, int[] damage, bool canDamageObjects, bool canDestroyWalls) 21 | { 22 | #if DEBUG 23 | if (0>radius) throw new ArgumentOutOfRangeException(nameof(radius), radius, "0>radius"); 24 | if (damage.Length != radius+1) throw new ArgumentOutOfRangeException(nameof(damage), damage.Length, "damage.Length != radius+1"); 25 | #endif 26 | Radius = radius; 27 | Damage = damage; 28 | CanDamageObjects = canDamageObjects; 29 | CanDestroyWalls = canDestroyWalls; 30 | } 31 | 32 | public readonly int DamageAt(int distance) 33 | { 34 | #if DEBUG 35 | if (distance < 0 || distance > Radius) throw new ArgumentOutOfRangeException(nameof(distance), distance, "out of range"); 36 | #endif 37 | return Damage[distance]; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemMedicineModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemMedicineModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | public sealed class ItemMedicineModel : Data.Model.Item 14 | { 15 | public readonly int Healing; 16 | public readonly int StaminaBoost; 17 | public readonly int SleepBoost; 18 | public readonly int InfectionCure; 19 | public readonly int SanityCure; 20 | 21 | public ItemMedicineModel(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, int healing, int staminaBoost, int sleepBoost, int infectionCure, int sanityCure, string flavor, int stackingLimit = 0) 22 | : base(_id, aName, theNames, imageID, flavor) 23 | { 24 | Healing = healing; 25 | StaminaBoost = staminaBoost; 26 | SleepBoost = sleepBoost; 27 | InfectionCure = infectionCure; 28 | SanityCure = sanityCure; 29 | if (1 new(this); 36 | public override ItemMedicine from(in Item_s src) => new(this, src.QtyLike); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Items_MeleeWeapons.csv: -------------------------------------------------------------------------------- 1 | ID,NAME,ATK,DMG,STA,DISARM,TOOLBASHDMGBONUS,TOOLBUILDBONUS,STACKINGLIMIT,ISFRAGILE,FLAVOR 2 | MELEE_BASEBALLBAT,"baseball bat",6,6,0,10,0,0.00,1,0,"Homerun!" 3 | MELEE_COMBAT_KNIFE,"combat knife",2,8,0,0,0,0.00,2,0,"Stab. Then stab some more." 4 | MELEE_CROWBAR,"crowbar",3,2,0,0,18,0.15,3,0,"A hero and its crowbar." 5 | UNIQUE_JASON_MYERS_AXE,"Jason Myers axe",14,14,4,10,0,0.00,1,0,"Free the serial killer in you!" 6 | MELEE_HUGE_HAMMER,"huge hammer",16,16,6,10,8,0.15,1,0,"Hammer time!" 7 | MELEE_GOLFCLUB,"golf club",8,4,0,10,0,0.00,1,1,"Play fair." 8 | MELEE_IRON_GOLFCLUB,"iron golf club",8,6,1,10,0,0.00,1,0,"Play hard." 9 | MELEE_SHOVEL,"shovel",10,10,2,10,5,0.10,1,0,"Makes a satisfying sound upon impact." 10 | MELEE_SHORT_SHOVEL,"short shovel",6,8,0,0,4,0.25,1,1,"Dig small holes. In heads." 11 | MELEE_TRUNCHEON,"truncheon",2,2,0,5,0,0.00,5,0,"Move along please." 12 | MELEE_IMPROVISED_CLUB,"improvised club",0,3,0,5,0,0.10,3,1,"Improvised bashing." 13 | MELEE_IMPROVISED_SPEAR,"improvised spear",2,2,0,5,0,0.00,2,1,"Improvised piercing." 14 | MELEE_SMALL_HAMMER,"small hammer",2,3,0,0,6,0.50,3,0,"(small)Hammer time!" 15 | UNIQUE_FAMU_FATARU_KATANA,"Famu Fataru katana",5,10,2,10,0,0.00,1,0,"Watashi wa no teki o kiru." 16 | UNIQUE_BIGBEAR_BAT,"Big Bear bat",8,14,1,15,0,0.00,1,0,"Smash the fools in the head." 17 | UNIQUE_ROGUEDJACK_KEYBOARD,"Roguedjack keyboard",30,6,1,25,0,0.00,1,0,"Le Basher De Bugs." 18 | UNIQUE_FATHER_TIME_SCYTHE,"Father Time scythe",2,6,1,10,0,0.00,1,0,"Harvests more than just grain." 19 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/CSVLine.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.CSVLine 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine 12 | { 13 | public class CSVLine 14 | { 15 | private readonly CSVField[] m_Fields; 16 | 17 | public CSVField this[int field] { 18 | get { 19 | #if DEBUG 20 | if (0 > field) throw new InvalidOperationException("0 > field"); 21 | #endif 22 | return m_Fields[field] 23 | #if DEBUG 24 | ?? throw new InvalidOperationException("m_Fields[field]") 25 | #endif 26 | ; 27 | } 28 | set { 29 | #if DEBUG 30 | if (0 > field) throw new InvalidOperationException("0 > field"); 31 | #endif 32 | m_Fields[field] = value 33 | #if DEBUG 34 | ?? throw new InvalidOperationException(nameof(value)) 35 | #endif 36 | ; 37 | } 38 | } 39 | 40 | public int FieldsCount { get { return m_Fields.Length; } } 41 | 42 | public CSVLine(string[] src) { 43 | #if DEBUG 44 | if (null == src || 1 > src.Length) throw new ArgumentNullException(nameof(src)); 45 | #endif 46 | m_Fields = new CSVField[src.Length]; 47 | int i = src.Length; 48 | while(0 <= --i) m_Fields[i] = new CSVField(src[i]); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/Observer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Zaimoni.Data 5 | { 6 | // observer pattern support 7 | public interface Observer 8 | { 9 | /// true if and only if should be de-registered 10 | bool update(T src); 11 | } 12 | 13 | [Serializable] 14 | public class Observed 15 | { 16 | private readonly List> m_Watchers = new List>(); 17 | 18 | public void update(T src) { 19 | var ub = m_Watchers.Count; 20 | while (0 <= --ub) { 21 | if (m_Watchers[ub].update(src)) m_Watchers.RemoveAt(ub); 22 | } 23 | } 24 | 25 | public void Add(Observer src) { if (!m_Watchers.Contains(src)) m_Watchers.Add(src); } 26 | } 27 | 28 | // not really observer pattern 29 | public interface Condition 30 | { 31 | bool IsDone(); 32 | /// 33 | /// Typically C status code convention: 0 success, negative error, positive warning. IsDone should return true for non-positive status codes. 34 | /// 35 | /// 0 implies IsDone() 36 | int StatusCode(); 37 | 38 | bool IsDone(T viewpoint); 39 | /// 40 | /// Typically C status code convention: 0 success, negative error, positive warning. IsDone should return true for non-positive status codes. 41 | /// 42 | /// 0 implies IsDone() 43 | int StatusCode(T viewpoint); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionLeaveMap.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionLeaveMap 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using djack.RogueSurvivor.Data; 9 | 10 | using Point = Zaimoni.Data.Vector2D; 11 | 12 | namespace djack.RogueSurvivor.Engine.Actions 13 | { 14 | internal class ActionLeaveMap : ActorAction, ActorDest 15 | { 16 | private readonly Point m_ExitPoint; 17 | 18 | public ActionLeaveMap(Actor actor, in Point exitPoint) : base(actor) 19 | { 20 | #if DEBUG 21 | if (actor.Location.Map.IsInBounds(exitPoint)) throw new ArgumentOutOfRangeException(nameof(exitPoint), exitPoint, "must not be InBounds"); 22 | #endif 23 | m_ExitPoint = exitPoint; 24 | } 25 | 26 | public Location dest { get { 27 | Location ret = new(m_Actor.Location.Map, m_ExitPoint); 28 | Map.Canonical(ref ret); 29 | return ret; 30 | } } 31 | 32 | public override bool IsLegal() 33 | { 34 | return m_Actor.CanLeaveMap(m_ExitPoint, out m_FailReason); 35 | } 36 | 37 | public override void Perform() 38 | { 39 | RogueGame.Game.DoLeaveMap(m_Actor, m_ExitPoint); 40 | } 41 | 42 | public override string ToString() 43 | { 44 | return m_Actor.Name+" leaving "+m_Actor.Location.ToString()+" for "+m_ExitPoint.to_s(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Goal/CoverTrap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using djack.RogueSurvivor.Data; 5 | using djack.RogueSurvivor.Engine.Items; 6 | 7 | using Zaimoni.Data; 8 | 9 | namespace djack.RogueSurvivor.Engine._Goal 10 | { 11 | [Serializable] 12 | internal class CoverTrap : Condition 13 | { 14 | private Location[] m_Locations; 15 | 16 | public CoverTrap(IEnumerable locs) { m_Locations = locs.ToArray(); } 17 | 18 | public static bool IsDone(in Location loc) { 19 | if (loc.Map.IsTrapCoveringMapObjectAt(loc.Position)) return true; 20 | return null == loc.Items?.GetItemsByType(trap => trap.IsActivated && 0 < trap.Model.Damage); 21 | } 22 | 23 | public static bool IsDone(in Location loc, Actor viewpoint) { 24 | int trapsMaxDamage = loc.Map.TrapsUnavoidableMaxDamageAtFor(loc.Position, viewpoint); 25 | return 0 >= trapsMaxDamage; 26 | } 27 | 28 | #region Condition implementation 29 | public bool IsDone() { 30 | foreach (var loc in m_Locations) if (!IsDone(in loc)) return false; 31 | return true; 32 | } 33 | 34 | public int StatusCode() { return IsDone() ? 0 : 1; } 35 | 36 | public bool IsDone(Actor viewpoint) { 37 | foreach (var loc in m_Locations) if (!IsDone(in loc, viewpoint)) return false; 38 | return true; 39 | } 40 | 41 | public int StatusCode(Actor viewpoint) { return IsDone(viewpoint) ? 0 : 1; } 42 | #endregion 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/TimedTask.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.TimedTask 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Data 10 | { 11 | [Serializable] 12 | public abstract class TimedTask : Zaimoni.Serialization.ISerialize 13 | { 14 | public int TurnsLeft { get; protected set; } 15 | 16 | public bool IsCompleted { get { return TurnsLeft <= 0; } } 17 | 18 | protected TimedTask(int turnsLeft) 19 | { 20 | TurnsLeft = turnsLeft; 21 | } 22 | 23 | #region implement Zaimoni.Serialization.ISerialize 24 | protected TimedTask(Zaimoni.Serialization.DecodeObjects decode) { 25 | int stage_int = 0; 26 | Zaimoni.Serialization.Formatter.Deserialize(decode.src, ref stage_int); 27 | TurnsLeft = stage_int; 28 | } 29 | 30 | protected void save(Zaimoni.Serialization.EncodeObjects encode) { 31 | Zaimoni.Serialization.Formatter.Serialize(encode.dest, TurnsLeft); 32 | } 33 | 34 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) { 35 | Zaimoni.Serialization.Formatter.Serialize(encode.dest, TurnsLeft); 36 | } 37 | #endregion 38 | 39 | public void Tick(Map m) 40 | { 41 | if (--TurnsLeft > 0) return; 42 | Trigger(m); 43 | } 44 | 45 | public abstract void Trigger(Map m); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/AdvisorHint.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.AdvisorHint 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Engine 10 | { 11 | [Serializable] 12 | internal enum AdvisorHint 13 | { 14 | MOVE_BASIC, 15 | MOUSE_LOOK, 16 | KEYS_OPTIONS, 17 | NIGHT, 18 | RAIN, 19 | ACTOR_MELEE, 20 | MOVE_RUN, 21 | MOVE_RESTING, 22 | MOVE_JUMP, 23 | ITEM_GRAB_CONTAINER, 24 | ITEM_GRAB_FLOOR, 25 | ITEM_UNEQUIP, 26 | ITEM_EQUIP, 27 | ITEM_TYPE_BARRICADING, 28 | ITEM_DROP, 29 | ITEM_USE, 30 | FLASHLIGHT, 31 | CELLPHONES, 32 | SPRAYS_PAINT, 33 | SPRAYS_SCENT, 34 | WEAPON_FIRE, 35 | WEAPON_RELOAD, 36 | GRENADE, 37 | DOORWINDOW_OPEN, 38 | DOORWINDOW_CLOSE, 39 | OBJECT_PUSH, 40 | OBJECT_BREAK, 41 | BARRICADE, 42 | EXIT_STAIRS_LADDERS, 43 | EXIT_LEAVING_DISTRICT, 44 | STATE_SLEEPY, 45 | STATE_HUNGRY, 46 | NPC_TRADE, 47 | NPC_GIVING_ITEM, 48 | NPC_SHOUTING, 49 | BUILD_FORTIFICATION, 50 | LEADING_NEED_SKILL, 51 | LEADING_CAN_RECRUIT, 52 | LEADING_GIVE_ORDERS, 53 | LEADING_SWITCH_PLACE, 54 | GAME_SAVE_LOAD, 55 | CITY_INFORMATION, 56 | CORPSE, 57 | CORPSE_EAT, 58 | SANITY, 59 | INFECTION, 60 | TRAPS, 61 | _COUNT, 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Serialization/StreamingContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | #nullable enable 4 | 5 | namespace Zaimoni.Serialization 6 | { 7 | /// 8 | /// Part of cloning the System.Runtime.Serialization specification, which is deprecated and cannot be assumed to be available indefinitely. 9 | /// 10 | public readonly struct StreamingContext 11 | { 12 | public readonly States State; 13 | public readonly object? Context; 14 | 15 | StreamingContext(States st = States.File, object? xtra = null) { 16 | State = st; 17 | Context = xtra; 18 | } 19 | 20 | // comment out the ones we don't handle 21 | [Flags] 22 | public enum States : byte { 23 | // CrossProcess = 1, // different process on same computer 24 | // CrossMachine = 2, // different computer 25 | File = 4, // files can last longer than the process, and do not require data from the process to deserialize 26 | // Persistence = 8, // some sort of persisted store; can last longer than the process, and do not require data from the process to deserialize 27 | // Remoting = 16, // context in an unknown location; may or may not be on same computer 28 | // Other = 32, // explicitly unknown (not foreseen) 29 | // Clone = 64, // in-memory deep clone within same process; handles/references to unmanaged resources should remain valid 30 | // CrossAppDomain = 128, // different Application Domain 31 | All = 255 // any defined source/destination context; morally unknown 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionCloseDoor.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionCloseDoor 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using djack.RogueSurvivor.Data; 9 | using djack.RogueSurvivor.Engine.MapObjects; 10 | 11 | namespace djack.RogueSurvivor.Engine.Actions 12 | { 13 | [Serializable] 14 | internal class ActionCloseDoor : ActorAction 15 | { 16 | private readonly DoorWindow m_Door; 17 | private readonly bool m_IsFreeAction; 18 | 19 | public ActionCloseDoor(Actor actor, DoorWindow door, bool free = false) : base(actor) 20 | { 21 | m_Door = door; 22 | m_IsFreeAction = free; 23 | } 24 | 25 | public DoorWindow Door { get { return m_Door; } } 26 | public bool IsFreeAction { get { return m_IsFreeAction; } } 27 | 28 | public override bool IsLegal() 29 | { 30 | return m_Actor.CanClose(m_Door, out m_FailReason); 31 | } 32 | 33 | public override bool IsPerformable() 34 | { 35 | if (!base.IsPerformable()) return false; 36 | return Rules.IsAdjacent(m_Actor.Location,m_Door.Location); 37 | } 38 | 39 | public override void Perform() 40 | { 41 | m_Door.SetState(DoorWindow.STATE_CLOSED); 42 | if (!m_IsFreeAction) m_Actor.SpendActionPoints(); 43 | RogueGame.Game.UI_CloseDoor(m_Actor, m_Door); 44 | } 45 | 46 | public override string? ToString() => "close "+m_Door.TheName; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/NullSoundManager.cs: -------------------------------------------------------------------------------- 1 | namespace djack.RogueSurvivor.Engine 2 | { 3 | class NullSoundManager : IMusicManager 4 | { 5 | #region Properties 6 | public bool IsMusicEnabled { get; set; } 7 | public int Volume { get; set; } 8 | public int Priority { get; private set; } 9 | public string Music { get; private set; } 10 | public bool IsPlaying { get { return false; } } 11 | public bool HasEnded { get { return true; } } 12 | #endregion 13 | 14 | #region Init 15 | public NullSoundManager() { } 16 | #endregion 17 | 18 | #region Loading music 19 | public bool Load(string musicname, string filename) { return true; } 20 | 21 | public void Unload(string musicname) { } 22 | #endregion 23 | 24 | #region Playing music 25 | 26 | public void Play(string musicname, int priority) { } 27 | 28 | //public void PlayIfNotAlreadyPlaying(string musicname) { } 29 | 30 | public void PlayLooping(string musicname, int priority) { } 31 | 32 | public void Stop() { } 33 | 34 | //public void ResumeLooping(string musicname) { } 35 | 36 | //public void Stop(string musicname) { } 37 | 38 | //public void StopAll() { } 39 | 40 | //public bool IsPlaying(string musicname) { return false; } 41 | 42 | //public bool IsPaused(string musicname) { return false; } 43 | 44 | //public bool HasEnded(string musicname) { return true; } 45 | #endregion 46 | 47 | #region IDisposable 48 | public void Dispose() { } 49 | #endregion 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /RogueSurvivor/Logger_mock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | #nullable enable 9 | 10 | namespace Zaimoni.Data 11 | { 12 | // Example of how to complete Zaimoni.Data.Logger 13 | static public partial class Logger 14 | { 15 | static public partial string LogDirectory() 16 | { 17 | return Path.Combine(Environment.CurrentDirectory, "Config"); 18 | } 19 | 20 | static public partial string LogFile() 21 | { 22 | return "log.txt"; 23 | } 24 | 25 | public enum Stage 26 | { 27 | INIT_MAIN, 28 | RUN_MAIN, 29 | CLEAN_MAIN, 30 | INIT_GFX, 31 | RUN_GFX, 32 | CLEAN_GFX, 33 | INIT_SOUND, 34 | RUN_SOUND, 35 | CLEAN_SOUND, 36 | RUN_DEBUG, 37 | } 38 | 39 | static private partial string toString(Stage s) 40 | { 41 | switch (s) 42 | { 43 | case Stage.INIT_MAIN: return "init main"; 44 | case Stage.RUN_MAIN: return "run main"; 45 | case Stage.CLEAN_MAIN: return "clean main"; 46 | case Stage.INIT_GFX: return "init gfx"; 47 | case Stage.RUN_GFX: return "run gfx"; 48 | case Stage.CLEAN_GFX: return "clean gfx"; 49 | case Stage.INIT_SOUND: return "init sound"; 50 | case Stage.RUN_SOUND: return "run sound"; 51 | case Stage.CLEAN_SOUND: return "clean sound"; 52 | default: return "misc"; 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemRangedWeaponModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemRangedWeaponModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | public sealed class ItemRangedWeaponModel : ItemWeaponModel 14 | { 15 | public readonly int MaxAmmo; 16 | public readonly AmmoType AmmoType; 17 | public readonly ItemRangedWeapon Example; // don't use this in real inventories; this object needs to be C++ const but C# doesn't have const correctness 18 | 19 | // alpha10 20 | public int RapidFireHit1Value { get { return Attack.Hit2Value; } } 21 | public int RapidFireHit2Value { get { return Attack.Hit3Value; } } 22 | public bool IsFireArm { get { return Attack.Kind == AttackKind.FIREARM; } } 23 | public bool IsBow { get { return Attack.Kind == AttackKind.BOW; } } 24 | 25 | public ItemRangedWeaponModel(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, Attack attack, int maxAmmo, AmmoType ammoType, string flavor, bool is_artifact = false) 26 | : base(_id, aName, theNames, imageID, attack, flavor, is_artifact) 27 | { 28 | MaxAmmo = maxAmmo; 29 | AmmoType = ammoType; 30 | Example = create(); 31 | } 32 | 33 | public override ItemRangedWeapon create() => new(this); 34 | public override ItemRangedWeapon from(in Item_s src) => new(this, src.QtyLike); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionUseExit.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionUseExit 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | internal class ActionUseExit : ActorAction,ActorDest,ActorOrigin 13 | { 14 | private readonly Location m_ExitPoint; 15 | 16 | #nullable enable 17 | 18 | public Exit Exit { get { return m_ExitPoint.Exit!; } } 19 | public bool IsNotBlocked { get { return Exit.IsNotBlocked(m_Actor); } } 20 | public Location dest { get { return Exit.Location; } } 21 | public Location origin { get { return m_ExitPoint; } } 22 | 23 | public ActionUseExit(Actor actor, in Location exitPoint) : base(actor) 24 | { 25 | #if DEBUG 26 | if (null == exitPoint.Exit) throw new ArgumentNullException("exitPoint.Exit"); 27 | #endif 28 | m_ExitPoint = exitPoint; 29 | actor.Activity = Activity.IDLE; 30 | } 31 | 32 | public override bool IsLegal() 33 | { 34 | return m_Actor.CanUseExit(out m_FailReason); 35 | } 36 | 37 | public override bool IsPerformable() 38 | { 39 | if (!Exit.IsNotBlocked(m_Actor)) return false; 40 | if (m_Actor.Location != m_ExitPoint) return false; 41 | return base.IsPerformable(); 42 | } 43 | 44 | public override void Perform() 45 | { 46 | RogueGame.Game.DoLeaveMap(m_Actor, m_ExitPoint.Position); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/Cache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | #nullable enable 6 | 7 | namespace Zaimoni.Data.Cache 8 | { 9 | public class Associative where K : notnull 10 | { 11 | private const int CURRENT = 0; 12 | private const int STALE = 1; 13 | private readonly Dictionary[] m_Cache = new Dictionary[2]{new Dictionary(), new Dictionary()}; 14 | 15 | public bool Expire() { 16 | lock(m_Cache) { 17 | m_Cache[STALE].Clear(); 18 | var tmp = m_Cache[CURRENT]; 19 | m_Cache[CURRENT] = m_Cache[STALE]; 20 | m_Cache[STALE] = tmp; 21 | return 0 >= m_Cache[STALE].Count; 22 | } 23 | } 24 | 25 | public bool TryGetValue(K key, out V? value) 26 | { 27 | lock (m_Cache) { 28 | if (m_Cache[CURRENT].TryGetValue(key, out value)) return true; 29 | if (m_Cache[STALE].TryGetValue(key, out value)) { 30 | m_Cache[CURRENT].Add(key, value); 31 | m_Cache[STALE].Remove(key); 32 | return true; 33 | } 34 | } 35 | value = default; 36 | return false; 37 | } 38 | 39 | public void Set(K key, V value) 40 | { 41 | lock (m_Cache) { 42 | m_Cache[CURRENT][key] = value; 43 | m_Cache[STALE].Remove(key); 44 | } 45 | } 46 | 47 | public void Validate(Predicate fn) 48 | { 49 | lock (m_Cache) { 50 | m_Cache[CURRENT].OnlyIf(fn); 51 | m_Cache[STALE].OnlyIf(fn); 52 | } 53 | } 54 | } 55 | 56 | #if PROTOTYPE 57 | class Linear where K : notnull 58 | { 59 | } 60 | #endif 61 | } 62 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionSwitchPlace.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionSwitchPlace 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | internal class ActionSwitchPlace : ActorAction 13 | { 14 | private readonly Actor m_Target; 15 | 16 | public ActionSwitchPlace(Actor actor, Actor target) : base(actor) 17 | { 18 | m_Target = target 19 | #if DEBUG 20 | ?? throw new ArgumentNullException(nameof(target)) 21 | #endif 22 | ; 23 | } 24 | 25 | public override bool IsLegal() 26 | { 27 | return m_Actor.CanSwitchPlaceWith(m_Target,out m_FailReason); 28 | } 29 | 30 | public override void Perform() 31 | { 32 | RogueGame.Game.DoSwitchPlace(m_Actor, m_Target); 33 | } 34 | } 35 | 36 | internal class ActionSwitchPlaceEmergency : ActorAction 37 | { 38 | private readonly Actor m_Target; 39 | 40 | public ActionSwitchPlaceEmergency(Actor actor, Actor target) : base(actor) 41 | { 42 | m_Target = target 43 | #if DEBUG 44 | ?? throw new ArgumentNullException(nameof(target)) 45 | #endif 46 | ; 47 | } 48 | 49 | public override bool IsLegal() 50 | { 51 | return Rules.IsAdjacent(m_Actor.Location,m_Target.Location); // XXX doesn't set FailReason 52 | } 53 | 54 | public override void Perform() 55 | { 56 | RogueGame.Game.DoSwitchPlace(m_Actor, m_Target); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Collections/Enumerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | #nullable enable 8 | 9 | namespace Zaimoni.Collections 10 | { 11 | // Filtering enumerator. In principle we could use one with Func as well. 12 | // The general version should not be capable of serialization. 13 | 14 | // If profiling says there is a CPU problem, we can allow the undefined behavior of accessing 15 | // an out-of-range Current through by eliminating the ok member variable. 16 | internal class EnumeratorNondefault : IEnumerator where T:class 17 | { 18 | private readonly IEnumerator enumerator; 19 | private bool ok = false; 20 | 21 | public EnumeratorNondefault(IEnumerator src) => enumerator = src; 22 | public EnumeratorNondefault(IEnumerable src) => enumerator = src.GetEnumerator(); 23 | 24 | object? System.Collections.IEnumerator.Current { get { 25 | if (!ok) return default; 26 | return enumerator.Current; 27 | } } 28 | 29 | public T? Current { get { 30 | if (!ok) return default; 31 | return enumerator.Current; 32 | } } 33 | 34 | public void Dispose() => enumerator.Dispose(); 35 | 36 | public bool MoveNext() { 37 | while (enumerator.MoveNext()) { 38 | var test = enumerator.Current; 39 | if (test == default) continue; 40 | ok = true; 41 | return true; 42 | } 43 | ok = false; 44 | return false; 45 | } 46 | 47 | public void Reset() 48 | { 49 | enumerator.Reset(); 50 | ok = false; 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![CodeFactor](https://www.codefactor.io/repository/github/zaimoni/rsrevived/badge)](https://www.codefactor.io/repository/github/zaimoni/rsrevived) 2 | 3 | Forum: http://roguesurvivor.proboards.com/ 4 | 5 | Original Rogue Survivor: http://roguesurvivor.blogspot.com/ ; source at https://github.com/roguedjack/Rogue-Survivor-Alpha-9 . 6 | 7 | Alternate forum threads: 8 | 9 | http://www.bay12forums.com/smf/index.php?topic=157701.0 10 | 11 | The main licence is GPLv3 ( https://opensource.org/licenses/GPL-3.0 ), with specific additional requests from Roguedjack to be non-commercial and to maintain the original brand identity: http://roguesurvivor.proboards.com/post/2604 . 12 | 13 | Our siblings: 14 | 15 | RS Still Alive 16 | http://roguesurvivor.proboards.com/thread/377/rs-alive 17 | https://gitlab.com/RogueSurvivor-StillAlive/StillAlive 18 | 19 | Crossplatform RS Still Alive 20 | https://github.com/laleksic/StillAlive/tree/cross_platform 21 | 22 | Rogue Survivor Rezombiefied 23 | http://www.bay12forums.com/smf/index.php?topic=177355.0 24 | https://github.com/GalacticChimp/RogueSurvivorRezombified 25 | 26 | UNIX build of RS Alpha 9 27 | http://roguesurvivor.proboards.com/thread/378/rogue-survivor-linux 28 | https://github.com/Stenodyon/Rogue-Survivor-Linux 29 | 30 | ======== 31 | 32 | Please note a recent reversion in the release format. To accommodate incremental upgrades for players with weak Internet connections, binary-only and media-only ZIPs that are not intended to be playable out of the box are being provided for the unstable releases starting with 2018-04-04. 33 | 34 | Starting with August 18 2018, there are three such archives: binary-only, sound-only, and media-no-sound. 35 | 36 | First installs on a machine should use a complete ZIP archive. FOr incremental upgrades, the binary archive is always required. The media archives are needed if and only if they exist. 37 | -------------------------------------------------------------------------------- /RogueSurvivor/Properties/Resources.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Properties.Resources 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System.CodeDom.Compiler; 8 | using System.ComponentModel; 9 | using System.Diagnostics; 10 | using System.Globalization; 11 | using System.Resources; 12 | using System.Runtime.CompilerServices; 13 | 14 | namespace djack.RogueSurvivor.Properties 15 | { 16 | [DebuggerNonUserCode] 17 | [CompilerGenerated] 18 | [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "9.0.0.0")] 19 | internal class Resources 20 | { 21 | private static ResourceManager resourceMan; 22 | private static CultureInfo resourceCulture; 23 | 24 | [EditorBrowsable(EditorBrowsableState.Advanced)] 25 | internal static ResourceManager ResourceManager 26 | { 27 | get 28 | { 29 | if (object.ReferenceEquals((object) djack.RogueSurvivor.Properties.Resources.resourceMan, (object) null)) 30 | djack.RogueSurvivor.Properties.Resources.resourceMan = new ResourceManager("djack.RogueSurvivor.Properties.Resources", typeof (djack.RogueSurvivor.Properties.Resources).Assembly); 31 | return djack.RogueSurvivor.Properties.Resources.resourceMan; 32 | } 33 | } 34 | 35 | [EditorBrowsable(EditorBrowsableState.Advanced)] 36 | internal static CultureInfo Culture 37 | { 38 | get 39 | { 40 | return djack.RogueSurvivor.Properties.Resources.resourceCulture; 41 | } 42 | set 43 | { 44 | djack.RogueSurvivor.Properties.Resources.resourceCulture = value; 45 | } 46 | } 47 | 48 | internal Resources() 49 | { 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/TimeCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | #nullable enable 5 | 6 | namespace Zaimoni.Data 7 | { 8 | public sealed class TimeCache where K:notnull 9 | { 10 | private readonly Dictionary > _map = new Dictionary>(); 11 | private int _now; 12 | 13 | public bool Expire(int t0) { 14 | lock(_map) { 15 | _map.OnlyIf(t => t > t0); 16 | return 0 >= _map.Count; 17 | } 18 | } 19 | public void Now(int t0) { 20 | lock(_map) { 21 | if (!_map.ContainsKey(t0)) _map.Add(t0, new Dictionary()); 22 | _now = t0; 23 | } 24 | } 25 | 26 | public bool TryGetValue(K key, out V? value) 27 | { 28 | lock(_map) { 29 | if (_map[_now].TryGetValue(key,out value)) return true; 30 | foreach(KeyValuePair > x in _map) { 31 | if (x.Key == _now) continue; 32 | if (x.Value.TryGetValue(key,out value)) { 33 | if (x.Key < _now) { 34 | _map[_now][key] = value; 35 | x.Value.Remove(key); 36 | } 37 | return true; 38 | } 39 | } 40 | } 41 | return false; 42 | } 43 | 44 | public void Set(K key, V value) 45 | { 46 | lock(_map) { 47 | if (!_map.TryGetValue(_now, out var cache)) _map.Add(_now, (cache = new Dictionary())); 48 | cache[key] = value; 49 | foreach(KeyValuePair > x in _map) { 50 | if (x.Key != _now) x.Value.Remove(key); 51 | } 52 | } 53 | } 54 | 55 | public void Validate(Predicate fn) 56 | { 57 | lock(_map) { _map[_now].OnlyIf(fn); } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionBump.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionBump 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using djack.RogueSurvivor.Data; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | internal class ActionBump : ActorAction, Resolvable, ActorDest 13 | { 14 | private readonly Direction m_Direction; 15 | private readonly Location m_NewLocation; 16 | private readonly ActorAction m_ConcreteAction; 17 | 18 | public Location dest { get { return m_NewLocation; } } 19 | 20 | public Direction Direction { get { return m_Direction; } } 21 | public ActorAction ConcreteAction { get { return m_ConcreteAction; } } 22 | 23 | public ActionBump(Actor actor, Direction direction) : base(actor) 24 | { 25 | m_Direction = direction; 26 | m_NewLocation = actor.Location + direction; // tentatively excluding this ActionBump class from IsPerformable upgrade due to this 27 | m_ConcreteAction = Rules.IsBumpableFor(m_Actor, in m_NewLocation, out m_FailReason); 28 | #if DEBUG 29 | if (null != m_ConcreteAction && !m_ConcreteAction.IsPerformable()) throw new ArgumentOutOfRangeException(nameof(m_ConcreteAction), m_ConcreteAction, "not performable"); 30 | #endif 31 | } 32 | 33 | public override bool IsLegal() 34 | { 35 | if (m_ConcreteAction == null) return false; 36 | return m_ConcreteAction.IsLegal(); 37 | } 38 | 39 | public override void Perform() 40 | { 41 | if (m_ConcreteAction == null) return; 42 | m_ConcreteAction.Perform(); 43 | } 44 | 45 | public override string ToString() { return m_ConcreteAction.ToString(); } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Tasks/TaskRemoveDecoration.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Tasks.TaskRemoveDecoration 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | using System.Collections.Generic; 10 | 11 | using Point = Zaimoni.Data.Vector2D; 12 | 13 | #nullable enable 14 | 15 | namespace djack.RogueSurvivor.Engine.Tasks 16 | { 17 | [Serializable] 18 | internal class TaskRemoveDecoration : TimedTask, Zaimoni.Serialization.ISerialize 19 | { 20 | private readonly List m_pt; // or HashSet 21 | private readonly string m_imageID; 22 | 23 | public string WillRemove { get { return m_imageID; } } 24 | 25 | public TaskRemoveDecoration(int turns, in Point pt, string imageID) 26 | : base(turns) 27 | { 28 | m_pt = new List { pt }; 29 | m_imageID = imageID; 30 | } 31 | 32 | #region implement Zaimoni.Serialization.ISerialize 33 | protected TaskRemoveDecoration(Zaimoni.Serialization.DecodeObjects decode) : base(decode) { 34 | Zaimoni.Serialization.Formatter.Deserialize(decode.src, ref m_imageID); 35 | } 36 | 37 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) { 38 | base.save(encode); 39 | Zaimoni.Serialization.Formatter.Serialize(encode.dest, m_imageID); 40 | } 41 | #endregion 42 | 43 | 44 | public override void Trigger(Map m) { 45 | foreach(var pt in m_pt) m.RemoveDecorationAt(m_imageID, in pt); 46 | } 47 | 48 | public void Add(Point dest) { if (!m_pt.Contains(dest)) m_pt.Add(dest); } 49 | public bool Remove(Point dest) { m_pt.Remove(dest); return 0 >= m_pt.Count; } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionMoveStep.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionMoveStep 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | using Point = Zaimoni.Data.Vector2D; 10 | 11 | namespace djack.RogueSurvivor.Engine.Actions 12 | { 13 | public sealed class ActionMoveStep : ActorAction, ActorDest 14 | { 15 | private readonly Location m_NewLocation; 16 | 17 | public Location dest { get { return m_NewLocation; } } 18 | 19 | public ActionMoveStep(Actor actor, in Point to) : base(actor) 20 | { 21 | m_NewLocation = new Location(actor.Location.Map, to); 22 | } 23 | 24 | public ActionMoveStep(Actor actor, in Location to) : base(actor) 25 | { 26 | m_NewLocation = to; 27 | } 28 | 29 | public override bool IsLegal() 30 | { 31 | return m_Actor.CanEnter(m_NewLocation); 32 | } 33 | 34 | public override bool IsPerformable() 35 | { 36 | return m_NewLocation.IsWalkableFor(m_Actor, out m_FailReason) && Rules.IsAdjacent(m_Actor.Location, m_NewLocation); 37 | } 38 | 39 | public override void Perform() 40 | { 41 | if (m_Actor.Location.Map==m_NewLocation.Map) RogueGame.Game.DoMoveActor(m_Actor, in m_NewLocation); 42 | else if (m_Actor.Location.Map.DistrictPos!=m_NewLocation.Map.DistrictPos) { 43 | var test = m_Actor.Location.Map.Denormalize(in m_NewLocation); 44 | RogueGame.Game.DoLeaveMap(m_Actor, test.Value.Position); 45 | } else RogueGame.Game.DoLeaveMap(m_Actor, m_Actor.Location.Position); 46 | } 47 | 48 | public override string ToString() 49 | { 50 | return "step: "+m_Actor.Location+" to "+m_NewLocation; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Tasks/TaskEscapeNanny.cs: -------------------------------------------------------------------------------- 1 | using djack.RogueSurvivor.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | using Point = Zaimoni.Data.Vector2D; 6 | 7 | #nullable enable 8 | 9 | namespace djack.RogueSurvivor.Engine.Tasks 10 | { 11 | [Serializable] 12 | class TaskEscapeNanny : TimedTask, Zaimoni.Serialization.ISerialize 13 | { 14 | private readonly List _escapees; 15 | private readonly HashSet _safe_zone; 16 | 17 | public TaskEscapeNanny(List escapees, HashSet safe_zone) : base(1) 18 | { 19 | _escapees = escapees; 20 | _safe_zone = safe_zone; 21 | } 22 | 23 | public TaskEscapeNanny(Actor escapee, HashSet safe_zone) : base(1) 24 | { 25 | _escapees = new() { escapee }; 26 | _safe_zone = safe_zone; 27 | } 28 | 29 | #region implement Zaimoni.Serialization.ISerialize 30 | protected TaskEscapeNanny(Zaimoni.Serialization.DecodeObjects decode) : base(decode) { 31 | } 32 | 33 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) { 34 | base.save(encode); 35 | } 36 | #endregion 37 | 38 | public override void Trigger(Map m) 39 | { 40 | _escapees.RemoveAll(a => a.IsDead); 41 | if (0 >= _escapees.Count) return; 42 | _escapees.RemoveAll(a => a.Location.Map==m && _safe_zone.Contains(a.Location.Position)); 43 | if (0 >= _escapees.Count) return; 44 | foreach(var a in _escapees) { 45 | var ai = a.Controller as Gameplay.AI.ObjectiveAI; 46 | if (null != ai.Goal() || null != ai.Goal()) continue; 47 | ai.GoalHeadFor(m,_safe_zone); 48 | } 49 | 50 | TurnsLeft = 1; // regenerate -- do not thrash GC 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/PlayerCommand.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.PlayerCommand 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | namespace djack.RogueSurvivor.Engine 8 | { 9 | internal enum PlayerCommand 10 | { 11 | NONE, 12 | QUIT_GAME, 13 | HELP_MODE, 14 | ADVISOR, 15 | OPTIONS_MODE, 16 | KEYBINDING_MODE, 17 | HINTS_SCREEN_MODE, 18 | SCREENSHOT, 19 | SAVE_GAME, 20 | LOAD_GAME, 21 | ABANDON_GAME, 22 | MOVE_N, 23 | MOVE_NE, 24 | MOVE_E, 25 | MOVE_SE, 26 | MOVE_S, 27 | MOVE_SW, 28 | MOVE_W, 29 | MOVE_NW, 30 | RUN_TOGGLE, 31 | WAIT_OR_SELF, 32 | WAIT_LONG_XXX, // don't want to change enumeration, but this command was a deathtrap by typo 33 | BARRICADE_MODE, 34 | BREAK_MODE, 35 | BUILD_LARGE_FORTIFICATION, 36 | BUILD_SMALL_FORTIFICATION, 37 | CLOSE_DOOR, 38 | EAT_CORPSE, 39 | FIRE_MODE, 40 | GIVE_ITEM, 41 | INITIATE_TRADE, 42 | LEAD_MODE, 43 | MARK_ENEMIES_MODE, 44 | ORDER_MODE, 45 | PUSH_MODE, 46 | REVIVE_CORPSE, 47 | SHOUT, 48 | SLEEP, 49 | SWITCH_PLACE, 50 | USE_EXIT, 51 | USE_SPRAY, 52 | CITY_INFO, 53 | MESSAGE_LOG, 54 | ITEM_SLOT_0, 55 | ITEM_SLOT_1, 56 | ITEM_SLOT_2, 57 | ITEM_SLOT_3, 58 | ITEM_SLOT_4, 59 | ITEM_SLOT_5, 60 | ITEM_SLOT_6, 61 | ITEM_SLOT_7, 62 | ITEM_SLOT_8, 63 | ITEM_SLOT_9, 64 | ITEM_INFO, 65 | DAIMON_MAP, 66 | ABANDON_PC, 67 | ALLIES_INFO, 68 | FACTION_INFO, 69 | ORDER_PC_MODE, 70 | SET_WAYPOINT, 71 | CLEAR_WAYPOINT, 72 | PULL_MODE, // alpha10 73 | COUNTERMAND_PC, 74 | UNLOAD, 75 | TRANSFER_ITEM, 76 | AS_AI, 77 | FAUST 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemFoodModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemFoodModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Engine.Items 12 | { 13 | public sealed class ItemFoodModel : Data.Model.Item 14 | { 15 | public readonly int Nutrition; 16 | public readonly bool IsPerishable; 17 | public readonly int BestBeforeDays; 18 | 19 | public ItemFoodModel(Gameplay.Item_IDs _id, string aName, string theNames, string imageID, int nutrition, int bestBeforeDays, int stackingLimit, string flavor) 20 | : base(_id, aName, theNames, imageID, flavor) 21 | { 22 | Nutrition = nutrition; 23 | if (bestBeforeDays < 0) { 24 | IsPerishable = false; 25 | } else { 26 | IsPerishable = true; 27 | BestBeforeDays = bestBeforeDays; 28 | } 29 | IsPlural = (aName==theNames); 30 | StackingLimit = stackingLimit; 31 | } 32 | 33 | // while a case can be made for army rations to be permanent food, it's much easier to see cans not degrading quickly than the ration packaging. 34 | // RS 9 does not have a random component to their duration, unlike groceries 35 | public override Item create() => instantiate(); 36 | 37 | public ItemFood instantiate() 38 | { 39 | if (ID==Gameplay.Item_IDs.FOOD_ARMY_RATION) return new(Session.Get.WorldTime.TurnCounter + WorldTime.TURNS_PER_DAY * BestBeforeDays, this); 40 | return new ItemFood(this); 41 | } 42 | 43 | public ItemFood instantiate(int bestBefore) => new(bestBefore, this); 44 | public override ItemFood from(in Item_s src) => (IsPerishable) ? new(src.QtyLike, this) : new(this, src.QtyLike); 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Action/BehavioristABC.cs: -------------------------------------------------------------------------------- 1 | using djack.RogueSurvivor.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | #nullable enable 9 | 10 | namespace djack.RogueSurvivor.Engine._Action 11 | { 12 | // monolith code...not ideal, but trying to manage save/load issues 13 | // competes with class ActionSequence 14 | [Serializable] 15 | internal class BehavioristABC : ActorAction, Actions.Resolvable 16 | { 17 | private readonly ReflexCode _reflexCode; 18 | [NonSerialized] private bool _resolved = false; 19 | [NonSerialized] private ActorAction? _action = null; 20 | 21 | public BehavioristABC(Actor whom, ReflexCode code) : base(whom) { 22 | _reflexCode = code; 23 | } 24 | public override bool IsLegal() { 25 | resolve(); 26 | if (!_resolved) return true; 27 | if (null == _action) return false; 28 | return _action.IsLegal(); 29 | } 30 | public override bool IsPerformable() { 31 | resolve(); 32 | if (!_resolved) return true; 33 | if (null == _action) return false; 34 | return _action.IsPerformable(); 35 | } 36 | public override void Perform() { _action?.Perform(); } 37 | 38 | public ActorAction ConcreteAction { get { 39 | resolve(); 40 | return _action; 41 | } } 42 | 43 | private void resolve() { 44 | if (!_resolved && m_Actor.Location.Map.IsMyTurn(m_Actor)) { 45 | _resolved = true; 46 | switch (_reflexCode) { 47 | case ReflexCode.RecruitedLOS: 48 | _action = (m_Actor.Controller as Gameplay.AI.ObjectiveAI)?.RecruitedLOS(); 49 | return; 50 | } 51 | } 52 | } 53 | 54 | public enum ReflexCode { 55 | RecruitedLOS = 1 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionSequence.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using djack.RogueSurvivor.Data; 5 | 6 | namespace djack.RogueSurvivor.Engine.Actions 7 | { 8 | [Serializable] 9 | internal class ActionSequence : ActorAction 10 | { 11 | private readonly int _AP; 12 | private readonly int _turn; 13 | private readonly List _handler_codes; 14 | [NonSerialized] private ActorAction _result; 15 | 16 | public ActionSequence(Actor actor, IEnumerable codes) 17 | : base(actor) 18 | { 19 | #if DEBUG 20 | if (null == codes || !codes.Any()) throw new ArgumentNullException(nameof(codes)); 21 | #endif 22 | _AP = m_Actor.ActionPoints; 23 | _turn = m_Actor.Location.Map.LocalTime.TurnCounter; 24 | _handler_codes = codes.ToList(); 25 | } 26 | 27 | public override bool IsLegal() 28 | { 29 | if (_AP <= m_Actor.ActionPoints && _turn >= m_Actor.Location.Map.LocalTime.TurnCounter) return true; 30 | if (0 < _handler_codes.Count && !m_Actor.Controller.IsMyTurn()) return true; // XXX i.e., this ActionSequence class will not work for PlayerController 31 | return (_result ??= _resolve())?.IsPerformable() ?? false; 32 | } 33 | 34 | public override void Perform() 35 | { 36 | (_result ??= _resolve())?.Perform(); 37 | _result = null; 38 | } 39 | 40 | private ActorAction? _resolve() 41 | { 42 | while(0 < _handler_codes.Count) { 43 | var working = m_Actor.Controller.ExecAryZeroBehavior(_handler_codes[0]); 44 | if (null != working && working.IsPerformable()) return working; 45 | // \todo we're using a list so we can append further handlers 46 | _handler_codes.RemoveAt(0); 47 | } 48 | return null; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Doll.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.Doll 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Data 13 | { 14 | // while we *could* lift this into the Actor class, isolating screen UI from game data is technically reasonable. 15 | [Serializable] 16 | public readonly struct Doll 17 | { 18 | private readonly List?[]? m_Decorations; // XXX only valid if the Model imageID is null 19 | 20 | public Doll(ActorModel model) 21 | { 22 | m_Decorations = (string.IsNullOrEmpty(model.ImageID) ? new List[(int) DollPart._COUNT] : null); 23 | } 24 | 25 | public List? GetDecorations(DollPart part) => m_Decorations?[(int) part]; 26 | 27 | public void AddDecoration(DollPart part, string imageID) 28 | { 29 | #if DEBUG 30 | if (null == m_Decorations) throw new ArgumentNullException(nameof(m_Decorations)); 31 | #endif 32 | (GetDecorations(part) ?? (m_Decorations[(int) part] = new(1))).Add(imageID); 33 | } 34 | 35 | public void RemoveDecoration(string imageID) 36 | { 37 | for (DollPart index = DollPart.NONE; index < DollPart._COUNT; ++index) { 38 | var x = GetDecorations(index); 39 | if (null != x && x.Remove(imageID) && 0 >= x.Count) { 40 | m_Decorations![(int)index] = null; 41 | break; 42 | } 43 | } 44 | } 45 | 46 | public void RemoveAllDecorations() 47 | { 48 | #if DEBUG 49 | if (null == m_Decorations) throw new ArgumentNullException(nameof(m_Decorations)); 50 | #endif 51 | for (DollPart index = DollPart.NONE; index < DollPart._COUNT; ++index) 52 | m_Decorations[(int)index] = null; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionEatCorpse.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionEatCorpse 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | // schedulable version would target a Location 13 | internal class ActionEatCorpse : ActorAction,NotSchedulable 14 | { 15 | private readonly Corpse m_Target; 16 | 17 | public ActionEatCorpse(Actor actor, Corpse target) : base(actor) 18 | { 19 | m_Target = target 20 | #if DEBUG 21 | ?? throw new ArgumentNullException(nameof(target)) 22 | #endif 23 | ; 24 | } 25 | 26 | public override bool IsLegal() 27 | { 28 | m_FailReason = ReasonCant(); 29 | return string.IsNullOrEmpty(m_FailReason); 30 | } 31 | 32 | // strictly speaking, performability requires being in the same location 33 | // but all three of our construction callers handle this; this is a legacy class 34 | 35 | public override void Perform() 36 | { 37 | RogueGame.Game.DoEatCorpse(m_Actor, m_Target); 38 | } 39 | 40 | // AI support 41 | // this has to be coordinated with ReasonCantEatCorpse 42 | static public bool WantTo(Actor a) { 43 | if (a.Model.Abilities.IsUndead) return a.HitPoints < a.MaxHPs; // legal regardless, but AI would not choose this 44 | if (a.IsStarving) return true; 45 | return a.IsInsane; 46 | } 47 | 48 | private string ReasonCant() 49 | { // this needs revision for feral dogs, which do not have sanity and should be able to eat corpses when merely hungry 50 | if (!m_Actor.Model.Abilities.IsUndead && !m_Actor.IsStarving && !m_Actor.IsInsane) return "not starving or insane"; 51 | return ""; 52 | } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemSprayScent.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemSprayScent 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Items 13 | { 14 | [Serializable] 15 | public sealed class ItemSprayScent : Item, Zaimoni.Serialization.ISerialize 16 | { 17 | new public ItemSprayScentModel Model { get {return (base.Model as ItemSprayScentModel)!; } } 18 | private int m_SprayQty; 19 | 20 | public int SprayQuantity { 21 | get { return m_SprayQty; } 22 | set { 23 | if (value < 0) value = 0; 24 | m_SprayQty = Math.Min(value, Model.MaxSprayQuantity); 25 | } 26 | } 27 | 28 | 29 | public override bool IsUseless { get { return 0 >= SprayQuantity; } } 30 | 31 | public override Item_s toStruct() { return new Item_s(ModelID, SprayQuantity); } 32 | public override void toStruct(ref Item_s dest) 33 | { 34 | dest.ModelID = ModelID; 35 | dest.QtyLike = SprayQuantity; 36 | dest.Flags = 0; 37 | } 38 | 39 | public ItemSprayScent(ItemSprayScentModel model, int qty) : base(model) { SprayQuantity = qty; } 40 | public ItemSprayScent(ItemSprayScentModel model) : this(model, model.MaxSprayQuantity) {} 41 | 42 | #region implement Zaimoni.Serialization.ISerialize 43 | protected ItemSprayScent(Zaimoni.Serialization.DecodeObjects decode) : base(decode) { 44 | Zaimoni.Serialization.Formatter.Deserialize7bit(decode.src, ref m_SprayQty); 45 | } 46 | 47 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) { 48 | base.save(encode); 49 | Zaimoni.Serialization.Formatter.Serialize7bit(encode.dest, m_SprayQty); 50 | } 51 | #endregion 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /RogueSurvivor/Gameplay/AI/Sensors/SmellSensor.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Gameplay.AI.Sensors.SmellSensor 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using djack.RogueSurvivor.Engine.AI; 9 | using System; 10 | using System.Collections.Generic; 11 | 12 | using Rectangle = Zaimoni.Data.Box2D; 13 | 14 | namespace djack.RogueSurvivor.Gameplay.AI.Sensors 15 | { 16 | [Serializable] 17 | public readonly struct AIScent 18 | { 19 | public readonly int Strength; 20 | 21 | public AIScent(int strength) 22 | { 23 | Strength = strength; 24 | } 25 | } 26 | 27 | [Serializable] 28 | internal class SmellSensor 29 | { 30 | private readonly Odor m_OdorToSmell; 31 | private readonly List> m_List = new(9); 32 | 33 | public List> Scents { get { return m_List; } } 34 | 35 | public SmellSensor(Odor odorToSmell) 36 | { 37 | m_OdorToSmell = odorToSmell; 38 | } 39 | 40 | public List> Sense(Actor actor) 41 | { 42 | #if DEBUG 43 | if (OdorScent.MIN_STRENGTH > actor.SmellThreshold) throw new ArgumentOutOfRangeException(nameof(actor), OdorScent.MIN_STRENGTH.ToString()+" > actor.SmellThreshold"); 44 | #endif 45 | m_List.Clear(); 46 | int num = actor.SmellThreshold; // floors at 1 47 | Rectangle survey = new Rectangle(actor.Location.Position+Direction.NW, 3, 3); 48 | Map map = actor.Location.Map; 49 | int turnCounter = map.LocalTime.TurnCounter; 50 | survey.DoForEach(pt => { 51 | var scentAt = map.GetScentByOdorAt(m_OdorToSmell, in pt); // 0 is the no-scent value 52 | if (scentAt >= num) m_List.Add(new(new AIScent(scentAt), turnCounter, new Location(map, pt))); 53 | }); 54 | return m_List; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /RogueSurvivor/Gameplay/AI/SkeletonAI.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Gameplay.AI.SkeletonAI 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using djack.RogueSurvivor.Engine; 9 | using djack.RogueSurvivor.Engine.Actions; 10 | using djack.RogueSurvivor.Gameplay.AI.Sensors; 11 | using System; 12 | using System.Collections.Generic; 13 | 14 | using Point = Zaimoni.Data.Vector2D; 15 | using Percept = djack.RogueSurvivor.Engine.AI.Percept_; 16 | 17 | #nullable enable 18 | 19 | namespace djack.RogueSurvivor.Gameplay.AI 20 | { 21 | [Serializable] 22 | internal class SkeletonAI : BaseAI 23 | { 24 | public const LOSSensor.SensingFilter VISION_SEES = LOSSensor.SensingFilter.ACTORS; 25 | 26 | private readonly LOSSensor m_LOSSensor; 27 | 28 | public SkeletonAI(Actor src) : base(src) 29 | { 30 | m_LOSSensor = new LOSSensor(VISION_SEES, src); 31 | } 32 | 33 | public override List UpdateSensors() 34 | { 35 | return m_LOSSensor.Sense(); 36 | } 37 | 38 | public override HashSet FOV { get { return m_LOSSensor.FOV; } } 39 | public override Location[] FOVloc { get { return m_LOSSensor.FOVloc; } } 40 | public override Dictionary? friends_in_FOV { get { return m_LOSSensor.friends; } } 41 | public override Dictionary? enemies_in_FOV { get { return m_LOSSensor.enemies; } } 42 | 43 | protected override ActorAction? SelectAction() 44 | { 45 | const int IDLE_CHANCE = 80; 46 | 47 | var tmpAction = TargetGridMelee(_enemies = SortByGridDistance(FilterEnemies(_all = FilterSameMap(UpdateSensors())))); 48 | if (null != tmpAction) return tmpAction; 49 | 50 | if (Rules.Get.RollChance(IDLE_CHANCE)) return new ActionWait(m_Actor); 51 | return BehaviorWander(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/StateMapObject.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.StateMapObject 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | #nullable enable 10 | 11 | namespace djack.RogueSurvivor.Data 12 | { 13 | // both use cases are "not that many states" 14 | [Serializable] 15 | public abstract class StateMapObject : MapObject, Zaimoni.Serialization.ISerialize 16 | { 17 | protected int m_State; 18 | 19 | public int State { get => m_State; } 20 | abstract protected string StateToID(int x); // XXX intent is to validate before actually updating the state 21 | public override string ImageID { get => StateToID(m_State); } 22 | 23 | protected StateMapObject(string hiddenImageID) : base(hiddenImageID) {} 24 | protected StateMapObject(string hiddenImageID, Fire burnable) : base(hiddenImageID, burnable) {} 25 | #region implement Zaimoni.Serialization.ISerialize 26 | protected StateMapObject(Zaimoni.Serialization.DecodeObjects decode) : base(decode) { 27 | sbyte stage_sbyte = 0; 28 | Zaimoni.Serialization.Formatter.Deserialize(decode.src, ref stage_sbyte); 29 | m_State = stage_sbyte; 30 | } 31 | 32 | new protected void save(Zaimoni.Serialization.EncodeObjects encode) { 33 | base.save(encode); 34 | Zaimoni.Serialization.Formatter.Serialize(encode.dest, (sbyte)m_State); 35 | } 36 | 37 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) { 38 | base.save(encode); 39 | Zaimoni.Serialization.Formatter.Serialize(encode.dest, (sbyte)m_State); 40 | } 41 | #endregion 42 | 43 | // 2023-04-16: Conditional attributes don't work on override member functions in C#11 (hard syntax error) 44 | protected void _update(int newState) => m_State = newState; 45 | abstract public void SetState(int newState); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemPrimedExplosive.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemPrimedExplosive 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using System.Threading; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Items 13 | { 14 | [Serializable] 15 | public abstract class ItemPrimedExplosive : ItemExplosive // XXX should be abstract 16 | { 17 | private int m_FuseTimeLeft; 18 | 19 | public int FuseTimeLeft { get { return m_FuseTimeLeft; } } 20 | 21 | new public Data.Model.PrimedExplosive Model { get {return base.Model.Primed; } } 22 | public Data.Model.Explosive Unprimed { get {return base.Model; } } 23 | 24 | protected ItemPrimedExplosive(Data.Model.Explosive model) : base(model) 25 | { 26 | m_FuseTimeLeft = model.FuseDelay; 27 | } 28 | 29 | protected ItemPrimedExplosive(Data.Model.Explosive model, int delay) : base(model) 30 | { 31 | m_FuseTimeLeft = delay; // dud would be "much longer than designed" 32 | } 33 | 34 | #region implement Zaimoni.Serialization.ISerialize 35 | protected ItemPrimedExplosive(Zaimoni.Serialization.DecodeObjects decode) : base(decode) { 36 | Zaimoni.Serialization.Formatter.Deserialize7bit(decode.src, ref m_FuseTimeLeft); 37 | } 38 | 39 | new protected void save(Zaimoni.Serialization.EncodeObjects encode) { 40 | base.save(encode); 41 | Zaimoni.Serialization.Formatter.Serialize7bit(encode.dest, m_FuseTimeLeft); 42 | } 43 | #endregion 44 | 45 | 46 | public void Cook() { Interlocked.Exchange(ref m_FuseTimeLeft, 0); } // detonate immediately 47 | 48 | public bool Expire() { return 0 >= Interlocked.Decrement(ref m_FuseTimeLeft); } 49 | 50 | static public bool IsExpired(ItemPrimedExplosive e) { return 0 >= e.m_FuseTimeLeft; } 51 | 52 | public override Data.Item_s toStruct() { return new Data.Item_s(ModelID, m_FuseTimeLeft); } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Odor.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.Odor 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Data 10 | { 11 | [Serializable] 12 | public enum Odor : byte 13 | { 14 | LIVING, 15 | UNDEAD_MASTER, 16 | SUPPRESSOR // alpha 10 17 | } 18 | 19 | [Serializable] 20 | public class OdorScent : Zaimoni.Serialization.ISerialize 21 | { 22 | public const int MIN_STRENGTH = 1; 23 | public const int MAX_STRENGTH = 9*WorldTime.TURNS_PER_HOUR; 24 | 25 | private short m_Strength; 26 | public readonly Odor Odor; 27 | 28 | public int Strength { 29 | get { 30 | return m_Strength; 31 | } 32 | set { 33 | if (MIN_STRENGTH > value) m_Strength = 0; 34 | else if (MAX_STRENGTH < value) m_Strength = MAX_STRENGTH; 35 | else m_Strength = (short)value; 36 | } 37 | } 38 | 39 | public OdorScent(Odor odor, int strength) 40 | { 41 | Odor = odor; 42 | Strength = strength; 43 | } 44 | 45 | #region implement Zaimoni.Serialization.ISerialize 46 | public OdorScent(Zaimoni.Serialization.DecodeObjects decode) 47 | { 48 | byte stage = default; 49 | Zaimoni.Serialization.Formatter.Deserialize(decode.src, ref stage); 50 | Odor = (Odor)stage; 51 | Zaimoni.Serialization.Formatter.Deserialize7bit(decode.src, ref m_Strength); 52 | } 53 | 54 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) 55 | { 56 | Zaimoni.Serialization.Formatter.Serialize(encode.dest, (byte)Odor); 57 | Zaimoni.Serialization.Formatter.Serialize7bit(encode.dest, m_Strength); 58 | } 59 | #endregion 60 | 61 | public bool Decay(short decay_rate) 62 | { 63 | bool ret = MIN_STRENGTH > (m_Strength -= decay_rate); 64 | if (ret) m_Strength = 0; 65 | return ret; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/Logger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | #nullable enable 9 | 10 | namespace Zaimoni.Data 11 | { 12 | static public partial class Logger 13 | { 14 | readonly private static object s_Mutex = new object(); 15 | private static string s_LogCreated = null; 16 | private static int s_LineCount = 0; // don't worry about rollover 17 | 18 | #region Implement to complete class 19 | static public partial string LogDirectory(); 20 | static public partial string LogFile(); 21 | static private partial string toString(Stage stage); 22 | #endregion 23 | 24 | static public string LogFilePath() { return Path.Combine(LogDirectory(), LogFile()); } 25 | 26 | private static string LogPath() // callers provide lock 27 | { 28 | if (null == s_LogCreated) { 29 | var path = LogFilePath(); 30 | if (File.Exists(path)) File.Delete(path); 31 | Directory.CreateDirectory(LogDirectory()); 32 | using var text = File.CreateText(path); 33 | s_LogCreated = path; 34 | } 35 | return s_LogCreated; 36 | } 37 | 38 | public static void WriteLine(Stage stage, string text) 39 | { 40 | lock (s_Mutex) { 41 | string str = string.Format("{0} {1} : {2}", s_LineCount++, toString(stage), text); 42 | Console.Out.WriteLine(str); 43 | using var streamWriter = File.AppendText(LogPath()); 44 | streamWriter.WriteLine(str); 45 | streamWriter.Flush(); 46 | } 47 | } 48 | 49 | public static List Lines { get { 50 | var ret = new List(); 51 | string? str = null; 52 | using var streamReader = new StreamReader(LogPath()); 53 | while(true) { 54 | str = streamReader.ReadLine(); 55 | if (null == str) break; 56 | ret.Add(str); 57 | } 58 | return ret; 59 | } } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/Faction.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.Faction 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Data 13 | { 14 | public sealed class Faction 15 | { 16 | private readonly List m_Enemies = new List(1); 17 | 18 | public readonly GameFactions.IDs ID; 19 | public readonly string Name; 20 | public readonly string MemberName; 21 | public readonly bool LeadOnlyBySameFaction; 22 | 23 | public IEnumerable Enemies { get { return m_Enemies; } } 24 | 25 | public Faction(string name, string memberName, GameFactions.IDs id, bool leadOnlyBySameFaction = false) 26 | { 27 | #if DEBUG 28 | if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name)); 29 | if (string.IsNullOrEmpty(memberName)) throw new ArgumentNullException(nameof(memberName)); 30 | #endif 31 | ID = id; 32 | Name = name; 33 | MemberName = memberName; 34 | LeadOnlyBySameFaction = leadOnlyBySameFaction; 35 | } 36 | 37 | // This is supposed to be reflexive. 38 | // if the contains tests are omitted, the list entries can duplicate in theory. 39 | // In practice, we launch-block and fail during construction of GameFactions 40 | public void AddEnemy(Faction other) 41 | { 42 | if (!m_Enemies.Contains(other)) m_Enemies.Add(other); 43 | if (!other.m_Enemies.Contains(this)) other.m_Enemies.Add(this); 44 | } 45 | 46 | public bool IsEnemyOf(Faction other) 47 | { 48 | if (1 <= Engine.Session.Get.ScriptStage_PoliceCHARrelations) { 49 | if (GameFactions.ThePolice==this && GameFactions.TheCHARCorporation==other) return true; 50 | if (GameFactions.TheCHARCorporation == this && GameFactions.ThePolice == other) return true; 51 | } 52 | return other!=this && m_Enemies.Contains(other); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/JSON.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.Json; 6 | using System.Threading.Tasks; 7 | using static System.Windows.Forms.Design.AxImporter; 8 | 9 | #nullable enable 10 | 11 | namespace Zaimoni.JSON 12 | { 13 | static public class JSON_ext 14 | { 15 | static public string? TrySaveAsRef(this T src, Utf8JsonWriter writer) where T:class { 16 | var resolve = PreserveReferenceHandler.Resolver; 17 | var id = resolve.GetReference(src, out bool alreadyExists); 18 | if (alreadyExists) { 19 | writer.WriteStartObject(); 20 | writer.WriteString("$ref", id); 21 | writer.WriteEndObject(); 22 | return null; 23 | } 24 | return id; 25 | } 26 | 27 | static public void SaveAsRef(this T src, Utf8JsonWriter writer) where T : class 28 | { 29 | var resolve = PreserveReferenceHandler.Resolver; 30 | var id = resolve.GetReference(src); 31 | writer.WriteStartObject(); 32 | writer.WriteString("$ref", id); 33 | writer.WriteEndObject(); 34 | } 35 | 36 | public static T? TryReadRef(this ref Utf8JsonReader reader) where T:class 37 | { 38 | var test = reader; 39 | test.Read(); 40 | if (JsonTokenType.PropertyName == test.TokenType 41 | && test.ValueTextEquals("$ref")) 42 | { 43 | test.Read(); 44 | var id = test.GetString(); 45 | var resolve = PreserveReferenceHandler.Resolver; 46 | var obj = resolve.ResolveReference(id); 47 | reader.Skip(); 48 | if (obj is T dest) return dest; 49 | throw new JsonException("type mismatch: " + id + " is not "+typeof(T).FullName); 50 | } 51 | return null; 52 | } 53 | 54 | public static void RecordRef(this string relay_id, T src) where T : class { 55 | var resolve = PreserveReferenceHandler.Resolver; 56 | resolve.AddReference(relay_id, src); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Action/Choice.cs: -------------------------------------------------------------------------------- 1 | using djack.RogueSurvivor.Data; 2 | using djack.RogueSurvivor.Engine.Actions; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | 8 | #nullable enable 9 | 10 | // namespace Action conflicts with C# STL Action<> 11 | namespace djack.RogueSurvivor.Engine._Action 12 | { 13 | internal class Choice : ActorAction, Resolvable 14 | { 15 | private readonly List m_Options; 16 | 17 | [Conditional("DEBUG")] 18 | private void _RejectEmptyActions(IEnumerable src) { 19 | if (null == src || 0 >= src.Count()) throw new ArgumentNullException(nameof(src)); 20 | } 21 | 22 | public Choice(Actor actor, IEnumerable src) : base(actor) { 23 | _RejectEmptyActions(src); 24 | m_Options = src.ToList(); 25 | } 26 | 27 | public Choice(Actor actor, List src) : base(actor) { 28 | _RejectEmptyActions(src); 29 | m_Options = src; 30 | } 31 | 32 | public override bool IsLegal() { 33 | var ub = m_Options.Count; 34 | while (0 <= --ub) { 35 | if (m_Options[ub].IsLegal()) return true; 36 | m_Options.RemoveAt(ub); 37 | } 38 | return false; 39 | } 40 | 41 | public override bool IsPerformable() 42 | { 43 | foreach (var act in m_Options) { 44 | if (act.IsPerformable()) return true; 45 | } 46 | return false; 47 | } 48 | 49 | public override void Perform() => ConcreteAction?.Perform(); 50 | 51 | public ActorAction ConcreteAction { 52 | get { 53 | var ub = m_Options.Count; 54 | while (0 <= --ub) { 55 | if (m_Options[ub].IsPerformable()) continue; 56 | m_Options.RemoveAt(ub); 57 | } 58 | ub = m_Options.Count; 59 | if (0 >= ub) throw new InvalidOperationException("no performable actions to choose from"); 60 | return m_Actor.Controller.Choose(m_Options); 61 | } 62 | } 63 | 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /RogueSurvivor/Gameplay/GameTips.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Gameplay.GameTips 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | namespace djack.RogueSurvivor.Gameplay 8 | { 9 | internal static class GameTips 10 | { 11 | public static readonly string[] TIPS = new string[] 12 | { 13 | // livings 14 | "...livings tire faster at night?", 15 | "...some people will wreck havoc and attack others for food?", 16 | "...livings vision deteriorates when sleepy, under the rain or during the night?", 17 | "...you might stumble on some unique characters?", 18 | // undeads 19 | "...undeads can smell scents left by livings?", 20 | // doing stuff 21 | "...you can recharge battery powered items at powered generators?", 22 | "...you can use some sprays to cover your scents?", 23 | "...you can expore the sewers, the subway and basements?", 24 | "...you can shove people around or push cars?", 25 | "...you can try to wake up other people by shouting near them?", 26 | "...you may find police radios and various trackers helpful?", 27 | "...eating or butchering corpses is OK?", 28 | "...you can try to revive people with the medic skill?", 29 | // misc rules 30 | "...odors decay faster under the rain and in the sewers?", 31 | "...firearms are more likely to jam under the rain?", 32 | "...rain will put out fires?", // semi-trolling here 33 | "...wearing some outfits change the chances to get noticed by cops and gangs?", 34 | // followers 35 | "...you can use cellphones to keep contact with your followers?", 36 | "...followers will help you push objects?", 37 | "...followers can guard you while you sleep?", 38 | "...followers can guard your place while you are away?", 39 | // trolling 40 | "...death is only the beginning?", 41 | "...this tip is self-referential and useless?", 42 | "...this is real life?", 43 | "...you likely died a stupid death?" 44 | }; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemSprayPaint.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemSprayPaint 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | // VAPORWARE this needs something that makes it AI-worthy to use. Graffiti was a pre-apocalypse thing. 13 | // * Improvised flamethrower worked for James Bond 007. 14 | // * Z may not be that easy to blind in the first place. 15 | 16 | namespace djack.RogueSurvivor.Engine.Items 17 | { 18 | [Serializable] 19 | internal sealed class ItemSprayPaint : Item, Zaimoni.Serialization.ISerialize 20 | { 21 | new public ItemSprayPaintModel Model { get {return (base.Model as ItemSprayPaintModel)!; } } 22 | private int m_PaintQty; 23 | 24 | public int PaintQuantity { 25 | get { return m_PaintQty; } 26 | set { 27 | if (value < 0) value = 0; 28 | m_PaintQty = Math.Min(value, Model.MaxPaintQuantity); 29 | } 30 | } 31 | 32 | public override bool IsUseless { get { return 0 >= m_PaintQty; } } 33 | 34 | public override Item_s toStruct() => new(ModelID, m_PaintQty); 35 | public override void toStruct(ref Item_s dest) 36 | { 37 | dest.ModelID = ModelID; 38 | dest.QtyLike = m_PaintQty; 39 | dest.Flags = 0; 40 | } 41 | 42 | public ItemSprayPaint(ItemSprayPaintModel model, int qty) : base(model) { PaintQuantity = qty; } 43 | public ItemSprayPaint(ItemSprayPaintModel model) : this(model, model.MaxPaintQuantity) { } 44 | 45 | #region implement Zaimoni.Serialization.ISerialize 46 | protected ItemSprayPaint(Zaimoni.Serialization.DecodeObjects decode) : base(decode) { 47 | Zaimoni.Serialization.Formatter.Deserialize7bit(decode.src, ref m_PaintQty); 48 | } 49 | 50 | void Zaimoni.Serialization.ISerialize.save(Zaimoni.Serialization.EncodeObjects encode) { 51 | base.save(encode); 52 | Zaimoni.Serialization.Formatter.Serialize7bit(encode.dest, m_PaintQty); 53 | } 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionRechargeItemBattery.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionRechargeItemBattery 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Actions 13 | { 14 | internal class ActionRechargeItemBattery : ActorAction, Use, NotSchedulable 15 | { 16 | private readonly Item m_Item; 17 | private readonly BatteryPowered _batt; 18 | 19 | private ActionRechargeItemBattery(Actor actor, Item it) : base(actor) 20 | { 21 | _batt = it as BatteryPowered ?? throw new ArgumentNullException(nameof(it)); 22 | m_Item = it; 23 | } 24 | 25 | public Item Use { get { return m_Item; } } 26 | 27 | public override bool IsLegal() => true; 28 | 29 | public override void Perform() 30 | { 31 | m_Actor.SpendActionPoints(); 32 | m_Item.EquippedBy(m_Actor); 33 | _batt.Recharge(); 34 | RogueGame.Game.UI_RechargeItemBattery(m_Actor, m_Item); 35 | } 36 | 37 | public static Item? WantsToRecharge(Actor whom) { 38 | Item? it = whom.Inventory.GetFirstMatching(obj => obj.MaxBatteries - 1 > obj.Batteries); 39 | if (null != it) return it; 40 | return whom.Inventory.GetFirstMatching(obj => Gameplay.Item_IDs.TRACKER_POLICE_RADIO != obj.ModelID && obj.MaxBatteries - 1 > obj.Batteries); 41 | } 42 | 43 | public static ActionRechargeItemBattery? Recharge(Actor whom, Item? it) { 44 | // inline Actor::CanRecharge 45 | #if DEBUG 46 | if (!whom.Model.Abilities.CanUseItems) return null; 47 | #endif 48 | if (it is not BatteryPowered obj) return null; // should imply equippable 49 | if (obj.MaxBatteries-1 <= obj.Batteries) return null; // no-op 50 | if (!whom.Inventory.Contains(it)) return null; 51 | // it.EquippedBy(whom); // called when pathfinding, so no side effects here 52 | return new ActionRechargeItemBattery(whom, it); 53 | } 54 | 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/UniqueItem.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.UniqueItem 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using djack.RogueSurvivor.Engine; 9 | using System; 10 | 11 | namespace djack.RogueSurvivor.Engine 12 | { 13 | [Serializable] 14 | public readonly struct UniqueItem 15 | { 16 | public readonly Item TheItem; 17 | public readonly bool IsSpawned; 18 | 19 | public UniqueItem(Item src, bool spawn=true) 20 | { 21 | TheItem = src; 22 | IsSpawned = spawn; 23 | } 24 | } 25 | } 26 | 27 | namespace Zaimoni.Serialization { 28 | 29 | public partial interface ISave 30 | { 31 | // handler must save to the target location field, or else 32 | internal static void Load(DecodeObjects decode, ref UniqueItem dest, Action handler) 33 | { 34 | byte is_spawned = 0; 35 | Formatter.Deserialize(decode.src, ref is_spawned); 36 | 37 | ulong code; 38 | var stage_item = decode.Load(out code); 39 | if (null != stage_item) { 40 | dest = new(stage_item, 0 != is_spawned); 41 | return; 42 | } 43 | if (0 >= code) throw new ArgumentNullException("src.TheItem"); 44 | decode.Schedule(code, (o) => { 45 | if (o is Item it) handler(it, 0 != is_spawned); // local copy doesn't work for structs 46 | else throw new ArgumentNullException("src.TheItem"); 47 | }); 48 | } 49 | 50 | internal static void Save(Zaimoni.Serialization.EncodeObjects encode, in UniqueItem src) 51 | { 52 | byte is_spawned = (byte)(src.IsSpawned ? 1 : 0); 53 | Formatter.Serialize(encode.dest, is_spawned); 54 | 55 | var code = encode.Saving(src.TheItem); // obligatory, in spite of type prefix/suffix 56 | if (0 < code) Formatter.SerializeObjCode(encode.dest, code); 57 | else throw new ArgumentNullException("src.TheItem"); 58 | } 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/AmmoType.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.AmmoType 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using Zaimoni.Data; 9 | 10 | namespace djack.RogueSurvivor.Engine.Items 11 | { 12 | public enum AmmoType 13 | { 14 | LIGHT_PISTOL = 0, 15 | HEAVY_PISTOL = 1, 16 | LIGHT_RIFLE = 2, 17 | HEAVY_RIFLE = 3, 18 | SHOTGUN = 4, 19 | BOLT = 5, 20 | _COUNT 21 | } 22 | 23 | static internal class ExtensionAmmoType 24 | { 25 | static internal string Singular(this AmmoType at) 26 | { 27 | switch (at) { 28 | case AmmoType.LIGHT_PISTOL: return "light pistol bullet"; 29 | case AmmoType.HEAVY_PISTOL: return "heavy pistol bullet"; 30 | case AmmoType.SHOTGUN: return "shotgun shell"; 31 | case AmmoType.LIGHT_RIFLE: return "light rifle bullet"; 32 | case AmmoType.HEAVY_RIFLE: return "heavy rifle bullet"; 33 | case AmmoType.BOLT: return "bolt"; 34 | #if DEBUG 35 | default: throw new ArgumentOutOfRangeException("unhandled ammo type"); 36 | #else 37 | default: return "buggy bolt"; 38 | #endif 39 | } 40 | } 41 | 42 | static internal string Aggregate(this AmmoType at) // morally PluralName 43 | { 44 | switch (at) { 45 | case AmmoType.LIGHT_PISTOL: return "light pistol clip"; 46 | case AmmoType.HEAVY_PISTOL: return "heavy pistol clip"; 47 | case AmmoType.SHOTGUN: return "shotgun cartridge"; 48 | case AmmoType.LIGHT_RIFLE: return "light rifle clip"; 49 | case AmmoType.HEAVY_RIFLE: return "heavy rifle clip"; 50 | case AmmoType.BOLT: return "crossbow quiver"; 51 | #if DEBUG 52 | default: throw new ArgumentOutOfRangeException("unhandled ammo type"); 53 | #else 54 | default: return "buggy clip"; 55 | #endif 56 | } 57 | } 58 | 59 | static internal string Describe(this AmmoType at, bool plural=false) 60 | { 61 | if (AmmoType.SHOTGUN == at) return at.Aggregate(); 62 | return at.Singular().Plural(plural); // regular plural in English 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Items/ItemMeleeWeaponModel.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Items.ItemMeleeWeaponModel 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using Zaimoni.Data; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Engine.Items 13 | { 14 | public sealed class ItemMeleeWeaponModel : ItemWeaponModel 15 | { 16 | public readonly bool IsFragile; 17 | 18 | // alpha10 19 | public readonly int ToolBashDamageBonus; 20 | public readonly float ToolBuildBonus; 21 | public bool IsTool { get { return ToolBashDamageBonus != 0 || ToolBuildBonus != 0; } } 22 | 23 | public ItemMeleeWeaponModel(Gameplay.Item_IDs _id, string aName, string imageID, Attack attack, string flavor, int bash, float build, bool is_artifact = false) 24 | : base(_id, aName, is_artifact ? aName : aName.Plural(true), imageID, attack, flavor, is_artifact) 25 | { 26 | ToolBashDamageBonus = bash; 27 | ToolBuildBonus = build; 28 | } 29 | 30 | public ItemMeleeWeaponModel(Gameplay.Item_IDs _id, string aName, string imageID, Attack attack, string flavor, int bash, float build, int stackingLimit, bool fragile) 31 | : base(_id, aName, aName.Plural(true), imageID, attack, flavor, false) 32 | { 33 | StackingLimit = stackingLimit; 34 | IsFragile = fragile; 35 | ToolBashDamageBonus = bash; 36 | ToolBuildBonus = build; 37 | } 38 | 39 | public Attack BaseMeleeAttack(in ActorModel model) { 40 | return new Attack(Attack.Kind, Attack.Verb, Attack.HitValue + model.UnarmedAttack.HitValue, Attack.DamageValue + model.UnarmedAttack.DamageValue, Attack.StaminaPenalty); 41 | } 42 | 43 | public bool IsMartialArts { 44 | get { 45 | if (Gameplay.Item_IDs.UNIQUE_FATHER_TIME_SCYTHE==ID) return true; 46 | if (Gameplay.Item_IDs.UNIQUE_FAMU_FATARU_KATANA==ID) return true; 47 | return false; 48 | } 49 | } 50 | 51 | public override ItemMeleeWeapon create() => new(this); 52 | public override ItemMeleeWeapon from(in Item_s src) => new(this, src.QtyLike); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /PreRelease/readme.txt: -------------------------------------------------------------------------------- 1 | ROGUE SURVIVOR 2 | ============== 3 | 4 | > INSTALL 5 | - Just unzip somewhere. 6 | - "RogueSurvivor" application with the game icon is the game. 7 | - "RSConfig" application with the game icon is the configuration tool. 8 | 9 | > UNINSTALL 10 | - Just delete all the folders. 11 | 12 | > PROBLEM : GAME DOESN'T START OR CRASHES EARLY! 13 | If the game doesn't start or crash when you start a new game try the following steps one by one. 14 | 15 | 1. Run Rogue Survivor configuration program (RSConfig.exe). 16 | Try different combinations of Video and Sound options, Save&Exit and start the game at each try. 17 | "Managed DirectX" as Video or Sound is likely be the source of the crash. 18 | Try "GDI+" for Video and/or "SFML" for Sound. 19 | 20 | 2. (Vista/Win7) Run the game as administrator. 21 | 22 | If the game still doesn't work properly, you might need to update some system files. 23 | Restart your computer after each install. 24 | 25 | 1. Update your DirectX installation. 26 | Download "DirectX End-User Runtime Web Installer" from Microsoft here: 27 | http://www.microsoft.com/downloads/details.aspx?familyid=2da43d38-db71-4c1b-bc6a-9b6652cd92a3&displaylang=en 28 | 29 | 2. Update your .NET Framework. 30 | Download "Microsoft .NET Framework 3.5" from Microsoft there: 31 | http://www.microsoft.com/downloads/en/details.aspx?FamilyId=333325fd-ae52-4e35-b531-508d977d32a6&displaylang=en 32 | 33 | 3. Update your .NET Framakework part 2. 34 | Download "Microsoft .NET Framework 3.5 Service Pack 1" from Microsoft 35 | http://www.microsoft.com/downloads/details.aspx?familyid=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en 36 | 37 | 4. Update your graphics card drivers. 38 | 39 | 40 | > PROBLEM : I WAS AWAY FROM THE COMPUTER AND THE GAME CRASHED! 41 | Disable your screensaver. 42 | 43 | 44 | > OTHER BUGS 45 | If you tried the previous solutions and the game still crashes it should show you a game log. 46 | You also have a logfile "log.txt" created in your Rogue Survivor folder. 47 | Send me that log file at my email below. 48 | You can also send the last save file. 49 | You can also mail me if you think you spotted a bug that didn't crash your game. 50 | 51 | 52 | > MORE 53 | http://roguesurvivor.blogspot.com/ 54 | 55 | 56 | > CONTACT 57 | roguedjack@yahoo.fr 58 | 59 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionPull.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using djack.RogueSurvivor.Data; 3 | 4 | namespace djack.RogueSurvivor.Engine.Actions 5 | { 6 | internal interface ObjectOrigin 7 | { 8 | Location obj_origin { get; } // of m_Actor 9 | } 10 | 11 | [Serializable] 12 | class ActionPull : ActorAction, ActorDest, ObjectOrigin 13 | { 14 | #region Fields 15 | readonly MapObject m_Object; 16 | readonly Location m_MoveActorTo; 17 | #endregion 18 | 19 | public Location dest { get { return m_MoveActorTo; } } 20 | public Location obj_origin { get { return m_Object.Location; } } 21 | 22 | #region Init 23 | public ActionPull(Actor actor, MapObject pullObj, Direction moveActorDir) : base(actor) 24 | { 25 | m_Object = pullObj 26 | #if DEBUG 27 | ?? throw new ArgumentNullException(nameof(pullObj)) 28 | #endif 29 | ; 30 | m_MoveActorTo = m_Actor.Location + moveActorDir; 31 | if (!Map.Canonical(ref m_MoveActorTo)) throw new ArgumentNullException(nameof(m_MoveActorTo)); 32 | } 33 | 34 | public ActionPull(Actor actor, MapObject pullObj, Location moveActorTo) : base(actor) 35 | { 36 | if (!Map.Canonical(ref moveActorTo)) throw new ArgumentNullException(nameof(moveActorTo)); 37 | m_Object = pullObj 38 | #if DEBUG 39 | ?? throw new ArgumentNullException(nameof(pullObj)) 40 | #endif 41 | ; 42 | m_MoveActorTo = moveActorTo; 43 | } 44 | #endregion 45 | 46 | #region ActorAction 47 | public override bool IsLegal() 48 | { 49 | return m_Actor.CanPull(m_Object, in m_MoveActorTo, out m_FailReason); 50 | } 51 | 52 | public override bool IsPerformable() 53 | { 54 | if (!base.IsPerformable()) return false; 55 | return 1==Rules.GridDistance(m_Actor.Location, m_Object.Location) // no pull/push through vertical exits 56 | && 1==Rules.GridDistance(m_Actor.Location, m_MoveActorTo); 57 | } 58 | 59 | public override void Perform() 60 | { 61 | RogueGame.Game.DoPull(m_Actor, m_Object, in m_MoveActorTo); 62 | } 63 | #endregion 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /.hgtags: -------------------------------------------------------------------------------- 1 | 39c72165a6cdaed0b28db71aa70238a6d19da7cf alpha 9 fork RC 1 2 | 28c81784cb3b48433e203d1108a79ff0cbee4681 alpha 9 fork RC 2 3 | 66d2cb199afb64b52fd027522805bdd9e85beaaa alpha 9 fork RC 3 4 | a3492e470182e73541076eab76b3ec701c22da40 alpha 9 fork RC 4 5 | 7f1f646a2d6e8fecfc4a4698f66bb00c4fb47eeb alpha 9 fork RC 5 6 | 8e090b71505d38a84221b8b938da90545438d77d UNSTABLE ON DISTRICT CHANGE 4_01 GMT-5 2016-04-29 7 | 91230b18f23bd5947364110c4d6edf166efff2bb alpha 9 fork RC 6 8 | 89e62e77bd44d9db05bb2544cee9e6216c45302e Unstable - illegal operation exception tiggered in normal play 9 | 4ca8c55d9a8f45605a2997dcc78dcaa14cc01912 Stable -- May 12 2016 10 | 76062c93013be2996d8da646af2c6d18f3a64dd9 RS Revived RC 1 11 | 0c4f5f1d6d5e97174b2adc576ee90021cebf6035 RS Revived 0.9.1 12 | 3b82f38064040e7a61b4ca6ab4255fe643694bb9 RS Revived 0.9.2 13 | f538a4012911ec7a27cb07016adf5ecbcf09c5da RS Revived 0.9.3 14 | 4dada87812ed8df63e8135b140bb805aa3b82aa2 RS Revived 0.9.4 15 | 610364d6317ab3a9a3a45b277410a6f1e31f2bfd RS Revived 0.9.5 16 | 7c4cb1b0e2c21ed582981b98ada00e01e6c1fa8f RS Revived 0.9.6 17 | e4bc95b89c68495ff6c04b302c1b823a8e1109c6 RS Revived 0.9.7 18 | 813066da8efd69e041440001887b1c68c80897d3 RS Revived 0.9.8 19 | 727f22a222df660f9364108c4764f121c2895226 RS Revived 0.9.9 20 | 67c8476c32be3fb42fa26b36b77e5aaa1dc891dc RS Revived 0.9.9.1 21 | b712f5f6ccc007277d0b9c2e3a4866217afddfb8 RS Revived 0.9.9.2 22 | 183e3bccec132e124fa6ea66ecfacb41d2f48914 Unstable 2018-03-25 23 | 183e3bccec132e124fa6ea66ecfacb41d2f48914 Unstable 2018-03-25 24 | 0000000000000000000000000000000000000000 Unstable 2018-03-25 25 | 0000000000000000000000000000000000000000 Unstable 2018-03-25 26 | f381048735a24f8a317d90e1c3cc99148b6ae1a5 Unstable 2018-03-25 27 | 44aae2dc17ec427e50e827d969591cf326f6ad30 Unstable 2018-03-31 28 | cbf5c8e40b082b8189dff60a34c3d394ed404f5f Unstable 2018-04-04 29 | 211b1ec202ff49bda58601768326cbc55ca87d88 Unstable 2018-04-07 30 | 073285a2799ffcf19794a5d980c2688c6a00b485 Unstable 2018-04-18 31 | 4b22ed23a3cdd0bef6a811ec96cd8ab9a7ba989b Unstable 2018-04-25 32 | 4dbf22caa19c49ddae21f52b0305268a3b316614 Unstable 2018-08-18 33 | 8f316f4cb3eac2cb8d4f751d69b4b2f95ad1049a Unstable 2018-08-20 34 | 1481bb56c64b6c0334ef56c3b304cd4f0311fe43 Unstable 2019-05-31 35 | 848342d04145ce256c7de5fa42f0d483618bea44 Unstable 2019-06-01 36 | 1a1526183a1a06178b0f60bba1283d263f5eb883 Unstable 2019-06-07 37 | d6cfdcaa9428efd2dcbd101ae91ea2a54fe41d8b Unstable 2019-07-04 38 | -------------------------------------------------------------------------------- /RogueSurvivor/Gameplay/AI/RatAI.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Gameplay.AI.RatAI 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using djack.RogueSurvivor.Gameplay.AI.Sensors; 9 | using System; 10 | using System.Collections.Generic; 11 | 12 | using Point = Zaimoni.Data.Vector2D; 13 | using Percept = djack.RogueSurvivor.Engine.AI.Percept_; 14 | 15 | #nullable enable 16 | 17 | namespace djack.RogueSurvivor.Gameplay.AI 18 | { 19 | [Serializable] 20 | internal class RatAI : BaseAI 21 | { 22 | public const LOSSensor.SensingFilter VISION_SEES = LOSSensor.SensingFilter.ACTORS | LOSSensor.SensingFilter.CORPSES; 23 | 24 | private readonly LOSSensor m_LOSSensor; 25 | private readonly SmellSensor m_LivingSmellSensor = new SmellSensor(Odor.LIVING); 26 | 27 | public RatAI(Actor src) : base(src) 28 | { 29 | m_LOSSensor = new LOSSensor(VISION_SEES, src); 30 | } 31 | 32 | public override List UpdateSensors() 33 | { 34 | m_LivingSmellSensor.Sense(m_Actor); 35 | return m_LOSSensor.Sense(); 36 | } 37 | 38 | public override HashSet FOV { get { return m_LOSSensor.FOV; } } 39 | public override Location[] FOVloc { get { return m_LOSSensor.FOVloc; } } 40 | public override Dictionary? friends_in_FOV { get { return m_LOSSensor.friends; } } 41 | public override Dictionary? enemies_in_FOV { get { return m_LOSSensor.enemies; } } 42 | 43 | protected override ActorAction? SelectAction() 44 | { 45 | ActorAction? tmpAction; 46 | if (null != (_enemies = SortByGridDistance(FilterEnemies(_all = FilterSameMap(UpdateSensors()))))) { 47 | tmpAction = TargetGridMelee(_enemies); 48 | if (null != tmpAction) return tmpAction; 49 | } 50 | tmpAction = BehaviorGoEatCorpse(_all); 51 | if (null != tmpAction) return tmpAction; 52 | 53 | tmpAction = BehaviorTrackScent(m_LivingSmellSensor.Scents); 54 | if (null != tmpAction) { 55 | m_Actor.Activity = Activity.TRACKING; 56 | return tmpAction; 57 | } 58 | return BehaviorWander(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /RogueSurvivor/UI/IGameCanvas.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.UI.IGameCanvas 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | using Color = System.Drawing.Color; 10 | using Font = System.Drawing.Font; 11 | using Graphics = System.Drawing.Graphics; 12 | using Image = System.Drawing.Image; 13 | using Point = System.Drawing.Point; 14 | using Rectangle = System.Drawing.Rectangle; 15 | 16 | namespace djack.RogueSurvivor.UI 17 | { 18 | public interface IGameCanvas 19 | { 20 | bool ShowFPS { get; set; } 21 | 22 | bool NeedRedraw { get; set; } 23 | 24 | Point MouseLocation { get; set; } 25 | 26 | // mouse event support 27 | // formally should be Point, but we don't want to leak System.Drawing types more than we already are 28 | void Add(Action op); 29 | void Add(Func op); 30 | 31 | float ScaleX { get; } 32 | 33 | float ScaleY { get; } 34 | 35 | void FillGameForm(); 36 | 37 | void Clear(Color clearColor); 38 | 39 | void AddImage(Image img, int x, int y); 40 | void AddImage(Image img, int x, int y, Color tint); 41 | void AddImageTransform(Image img, int x, int y, float rotation, float scale); 42 | void AddTransparentImage(float alpha, Image img, int x, int y); 43 | void AddPoint(Color color, int x, int y); 44 | void AddLine(Color color, int xFrom, int yFrom, int xTo, int yTo); 45 | void AddRect(Color color, Rectangle rect); 46 | void AddFilledRect(Color color, Rectangle rect); 47 | void AddString(Font font, Color color, string text, int gx, int gy); 48 | 49 | // pre-rendering tiles 50 | void AddTile(Image img); 51 | void AddTile(Image img, Color color); 52 | void AppendTile(Image img); 53 | void AppendTile(Color color, string text, Font font, int x, int y); 54 | void DrawTile(int x, int y); 55 | 56 | // minimap support 57 | void ClearMinimap(Color color); 58 | void SetMinimapColor(int x, int y, Color color); 59 | void DrawMinimap(int gx, int gy); 60 | 61 | // screenshot 62 | string SaveScreenShot(string filePath); 63 | string ScreenshotExtension(); 64 | 65 | void DisposeUnmanagedResources(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /RogueSurvivor/Data/SkillTable.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Data.SkillTable 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | #nullable enable 11 | 12 | namespace djack.RogueSurvivor.Data 13 | { 14 | [Serializable] 15 | public class SkillTable 16 | { 17 | private Dictionary? m_Table; 18 | 19 | public IEnumerable>? Skills { get { return m_Table; } } 20 | 21 | public int CountSkills { get { return m_Table?.Count ?? 0; } } 22 | 23 | public SkillTable() 24 | { 25 | } 26 | 27 | private SkillTable(Dictionary? src) => m_Table = src; 28 | 29 | static public SkillTable Clone(SkillTable src) { 30 | return new(null != src.m_Table ? new(src.m_Table) : null); 31 | } 32 | 33 | /// sum of skill levels 34 | public int GetSkills(ref Zaimoni.Data.Stack dest) 35 | { 36 | if (null == m_Table) return 0; 37 | int ret = 0; 38 | foreach(var x in m_Table) { 39 | dest.push(x.Key); 40 | ret += x.Value; 41 | } 42 | return ret; 43 | } 44 | 45 | public int GetSkillLevel(djack.RogueSurvivor.Gameplay.Skills.IDs id) 46 | { 47 | if (null == m_Table) return 0; 48 | m_Table.TryGetValue(id, out sbyte skill); // default(sbyte) is 0: ok 49 | return skill; 50 | } 51 | 52 | public void AddOrIncreaseSkill(Gameplay.Skills.IDs id) 53 | { 54 | if (!(m_Table ??= new()).ContainsKey(id)) m_Table[id] = 1; 55 | else ++m_Table[id]; 56 | } 57 | 58 | public void DecOrRemoveSkill(Gameplay.Skills.IDs id) 59 | { 60 | if (null == m_Table || !m_Table.ContainsKey(id) || 0 < --m_Table[id]) return; 61 | m_Table.Remove(id); 62 | if (0 >= m_Table.Count) m_Table = null; 63 | } 64 | 65 | public Gameplay.Skills.IDs? LoseRandomSkill() 66 | { 67 | if (null == m_Table || 0 >= m_Table.Count) return null; // inline CountSkills 68 | var ret = Engine.Rules.Get.DiceRoller.Choose(m_Table); 69 | DecOrRemoveSkill(ret.Key); 70 | return ret.Key; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/FileExt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Runtime.Serialization; 4 | using System.Runtime.Serialization.Formatters.Binary; 5 | 6 | namespace Zaimoni.Data 7 | { 8 | public interface Factory 9 | { 10 | T create(); 11 | } 12 | 13 | static class FileExt 14 | { 15 | public static Stream CreateStream(this string filepath, bool save) 16 | { 17 | #if DEBUG 18 | if (string.IsNullOrEmpty(filepath)) throw new ArgumentNullException(nameof(filepath)); 19 | #endif 20 | return new FileStream(filepath, save ? FileMode.Create : FileMode.Open, save ? FileAccess.Write : FileAccess.Read, save ? FileShare.None : FileShare.Read); 21 | } 22 | 23 | public static void BinarySerialize<_T_>(this string filepath, _T_ src) 24 | { 25 | #if DEBUG 26 | if (string.IsNullOrEmpty(filepath)) throw new ArgumentNullException(nameof(filepath)); 27 | #endif 28 | using var stream = filepath.CreateStream(true); 29 | (new BinaryFormatter()).Serialize(stream, src); 30 | stream.Flush(); 31 | } 32 | public static _T_ BinaryDeserialize<_T_>(this string filepath) 33 | { 34 | #if DEBUG 35 | if (string.IsNullOrEmpty(filepath)) throw new ArgumentNullException(nameof(filepath)); 36 | #endif 37 | using var stream = filepath.CreateStream(false); 38 | return (_T_)(new BinaryFormatter()).Deserialize(stream); 39 | } 40 | 41 | #nullable enable 42 | public static void read(this SerializationInfo info, ref T dest, string src) where T : class 43 | { 44 | dest = info.GetValue(src, typeof(T)) as T ?? throw new ArgumentNullException(src); 45 | } 46 | 47 | public static void read_nullsafe(this SerializationInfo info, ref T? dest, string src) where T : class 48 | { 49 | dest = info.GetValue(src, typeof(T)) as T; // should have thrown already but this function doesn't have proper annotations 50 | } 51 | 52 | public static void read_s(this SerializationInfo info, ref T dest, string src) where T : struct // different function name due to defective C# generic functions relative to C++ templates 53 | { 54 | object? tmp = info.GetValue(src, typeof(T)); // should have thrown already but this function doesn't have proper annotations 55 | dest = (T)(tmp ?? throw new ArgumentNullException(src)); 56 | } 57 | #nullable restore 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionUseItem.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.Actions.ActionUseItem 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using djack.RogueSurvivor.Data; 8 | using System; 9 | 10 | namespace djack.RogueSurvivor.Engine.Actions 11 | { 12 | public interface Use where T:Item 13 | { 14 | public T Use { get; } 15 | } 16 | 17 | [Serializable] 18 | public sealed class ActionUseItem : ActorAction, Use 19 | { 20 | private readonly Item m_Item; 21 | 22 | public ActionUseItem(Actor actor, Item it) : base(actor) 23 | { 24 | m_Item = it 25 | #if DEBUG 26 | ?? throw new ArgumentNullException(nameof(it)) 27 | #endif 28 | ; 29 | actor.Activity = Activity.IDLE; 30 | } 31 | 32 | public Item Use { get { return m_Item; } } 33 | 34 | public override bool IsLegal() 35 | { 36 | return m_Actor.CanUse(m_Item, out m_FailReason); 37 | } 38 | 39 | public override void Perform() 40 | { 41 | RogueGame.Game.DoUseItem(m_Actor, m_Item); 42 | } 43 | } // ActionUseItem 44 | 45 | [Serializable] 46 | internal class ActionUse : ActorAction, Use 47 | { 48 | private readonly Gameplay.Item_IDs m_ID; 49 | [NonSerialized] private Item? m_Item = null; 50 | 51 | public ActionUse(Actor actor, Gameplay.Item_IDs it) : base(actor) 52 | { 53 | #if DEBUG 54 | if (!(Gameplay.GameItems.From(it).create() is UsableItem)) throw new ArgumentNullException(nameof(it)); 55 | #endif 56 | m_ID = it; 57 | } 58 | 59 | public Gameplay.Item_IDs ID { get { return m_ID; } } // for completeness 60 | 61 | public Item? Use { 62 | get { 63 | return m_Item ??= m_Actor.Inventory.GetBestDestackable(Gameplay.GameItems.From(m_ID)); 64 | } 65 | } 66 | 67 | public override bool IsLegal() 68 | { 69 | var it = Use; 70 | if (null == it) { 71 | m_FailReason = "not in inventory"; 72 | return false; 73 | } 74 | return m_Actor.CanUse(it, out m_FailReason); 75 | } 76 | 77 | public override void Perform() 78 | { 79 | m_Actor.Activity = Activity.IDLE; 80 | RogueGame.Game.DoUseItem(m_Actor, Use); 81 | } 82 | } // ActionUse 83 | } 84 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Serialization/SaveManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | #nullable enable 4 | 5 | namespace Zaimoni.Serialization 6 | { 7 | // these won't be completely reliable with structs 8 | interface IOnSerializing 9 | { 10 | void OnSerializing(in StreamingContext context); 11 | } 12 | 13 | interface IOnSerialized 14 | { 15 | void OnSerialized(in StreamingContext context); 16 | } 17 | 18 | /// 19 | /// Part of cloning the System.Runtime.Serialization specification, which is deprecated and cannot be assumed to be available indefinitely. 20 | /// This corresponds to SerializationObjectManager 21 | /// 22 | public sealed class SaveManager 23 | { 24 | private readonly StreamingContext _context; 25 | private readonly List _onSerializedTargets = new List(); // could use event syntax for this 26 | 27 | public SaveManager(StreamingContext context) { 28 | _context = context; 29 | } 30 | 31 | public void Register(object obj) 32 | { 33 | if (obj is IOnSerializing x) x.OnSerializing(in _context); 34 | if (obj is IOnSerialized y) 35 | { 36 | lock (_onSerializedTargets) 37 | { 38 | if (!_onSerializedTargets.Contains(y)) _onSerializedTargets.Add(y); 39 | } 40 | } 41 | } 42 | 43 | public void Register(T obj) where T:class { 44 | if (obj is IOnSerializing x) x.OnSerializing(in _context); 45 | if (obj is IOnSerialized y) { 46 | lock (_onSerializedTargets) { 47 | if (!_onSerializedTargets.Contains(y)) _onSerializedTargets.Add(y); 48 | } 49 | } 50 | } 51 | 52 | public void RaiseOnSerializedEvent() { 53 | lock (_onSerializedTargets) { 54 | var ub = _onSerializedTargets.Count; 55 | // \todo what we would like to do is "move" the backing array without copying, 56 | // do the countdown on the backing array, then let it scope out 57 | while (0 < --ub) { 58 | _onSerializedTargets[ub]!.OnSerialized(in _context); 59 | _onSerializedTargets[ub] = null; // trigger GC if we had boxed a struct 60 | } 61 | _onSerializedTargets.Clear(); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/Actions/ActionSprayOdorSuppressor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using djack.RogueSurvivor.Data; 4 | using djack.RogueSurvivor.Engine.Items; 5 | 6 | namespace djack.RogueSurvivor.Engine.Actions 7 | { 8 | #nullable enable 9 | 10 | // alpha10 11 | public sealed class ActionSprayOdorSuppressor : ActorAction, TargetActor, Use, NotSchedulable 12 | { 13 | private readonly ItemSprayScent m_Spray; 14 | private readonly Actor m_SprayOn; 15 | 16 | public ActionSprayOdorSuppressor(Actor actor, ItemSprayScent spray, Actor sprayOn) : base(actor) 17 | { 18 | #if DEBUG 19 | if (!actor.Model.Abilities.CanUseItems) throw new InvalidOperationException("cannot use items"); 20 | if (!actor.Inventory.Contains(spray)) throw new InvalidOperationException("spray not in inventory"); 21 | #endif 22 | m_Spray = spray; 23 | m_SprayOn = sprayOn 24 | #if DEBUG 25 | ?? throw new ArgumentNullException(nameof(sprayOn)) 26 | #endif 27 | ; 28 | } 29 | 30 | public Actor Whom { get => m_SprayOn; } 31 | public ItemSprayScent Use { get => m_Spray; } 32 | 33 | public override bool IsLegal() 34 | { 35 | m_FailReason = ReasonCant(m_Spray) ?? ReasonCant(m_Actor, m_SprayOn); 36 | return string.IsNullOrEmpty(m_FailReason); 37 | } 38 | 39 | public override void Perform() 40 | { 41 | m_Spray.EquippedBy(m_Actor); 42 | m_Actor.SpendActionPoints(); // spend AP. 43 | --m_Spray.SprayQuantity; // spend spray. 44 | m_SprayOn.OdorSuppressorCounter += m_Spray.Model.Strength; // add odor suppressor on spray target 45 | 46 | RogueGame.Game.UI_SprayOdorSuppressor(m_Actor, m_Spray, m_SprayOn); 47 | } 48 | 49 | // AI support 50 | public static string? ReasonCant(ItemSprayScent suppressor) 51 | { 52 | if (Odor.SUPPRESSOR != suppressor.Model.Odor) return "not an odor suppressor"; 53 | if (suppressor.SprayQuantity <= 0) return "No spray left."; 54 | 55 | return null; // all clear. 56 | } 57 | 58 | // technically about performability 59 | public static string? ReasonCant(Actor doer, Actor sprayOn) 60 | { 61 | if (sprayOn != doer && !Rules.IsAdjacent(doer.Location, sprayOn.Location)) return "not adjacent"; 62 | return null; // all clear. 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /PreRelease/Resources/Data/Actors.csv: -------------------------------------------------------------------------------- 1 | "ID","NAME","PLURAL","SPD","HP","STA","ATK","DMG","DEF","PRO_HIT","PRO_SHOT","FOV","AUDIO","SMELL","SCORE","FLAVOR" 2 | "UNDEAD_SKELETON","skeleton","skeletons",100,10,99,16,4,6,0,0,4,0,0,10,"Quite annoying. Like a fly. " 3 | "UNDEAD_RED_EYED_SKELETON","red-eyed skeleton","red-eyed skeletons",150,12,99,18,6,8,0,0,4,0,0,20,"Really annoying. Like a big fly." 4 | "UNDEAD_RED_SKELETON","red skeleton","red skeletons",200,14,99,20,8,10,0,0,4,0,0,40,"REALLY annoying! Kill it with fire!" 5 | "UNDEAD_ZOMBIE","shambler","shamblers",50,80,99,20,10,10,0,0,5,0,40,15,"BRAINS!" 6 | "UNDEAD_DARK_EYED_ZOMBIE","dark-eyed shamber","dark-eyed shamblers",50,120,99,24,12,14,0,0,5,0,60,30,"MORE BRAINS!" 7 | "UNDEAD_DARK_ZOMBIE","dark shambler","dark shamblers",50,160,99,28,14,16,0,0,5,0,80,60,"MORE NUTRITIVE CEREBRAL MATTER!" 8 | "UNDEAD_ZOMBIE_MASTER","zombie master","zombie masters",50,120,99,20,10,16,0,0,6,0,100,100,"Nice glasses." 9 | "UNDEAD_ZOMBIE_LORD","zombie lord","zombie lords",50,180,99,24,10,16,0,0,6,0,100,200,"Lord Of Death." 10 | "UNDEAD_ZOMBIE_PRINCE","zombie prince","zombie princes",50,240,99,28,16,16,0,0,6,0,100,400,"Prince Of Death." 11 | "UNDEAD_MALE_ZOMBIFIED","zombiefied man","zombified men",66,60,99,20,10,16,0,0,5,0,80,40,"A friend of yours?" 12 | "UNDEAD_MALE_NEOPHYTE","male neophyte","male neophytes",100,70,99,24,14,20,0,0,5,0,80,80,"People can change." 13 | "UNDEAD_MALE_DISCIPLE","male disciple","male disciples",125,80,99,28,20,24,0,0,5,0,80,160,"People DO change." 14 | "UNDEAD_RAT_ZOMBIE","zombie rat","zombie rats",200,6,99,12,2,6,0,0,2,0,100,5,"Large undead sewers rodent." 15 | "MALE_CIVILIAN","man","men",100,30,60,20,10,20,0,0,8,16,0,0,"Still alive?" 16 | "CHAR_GUARD","CHAR guard","CHAR guards",100,30,60,20,10,20,0,0,8,16,0,100,"Guarding guard is guarding." 17 | "ARMY_NATIONAL_GUARD","national guard","national guards",100,30,60,20,10,20,0,0,8,16,0,0,"Cleaning the mess." 18 | "BIKER_MAN","biker","bikers",100,30,60,20,10,20,0,0,8,16,0,50,"Motorized mayhem." 19 | "POLICEMAN","policeman","policemen",100,30,60,20,10,20,0,0,8,16,0,0,"To protect and to die." 20 | "GANGSTA_MAN","gangsta","gangstas",100,30,60,20,10,20,0,0,8,16,0,60,"Chillin' and dyin'." 21 | "BLACKOPS_MAN","blackOp","blackOps",100,30,60,20,10,20,0,0,8,16,0,80,"Erasing." 22 | "SEWERS_THING","Sewers thing","Sewers Things",33,400,99,28,12,8,0,0,5,0,5,300,"A relative of The Swamp Thing?" 23 | "JASON_MYERS","Serial Killer","Serial Killers",125,30,60,20,10,20,0,0,8,16,0,150,"(insert drug induced insanities)" 24 | "FERAL_DOG","feral dog","feral dogs",100,15,90,30,10,15,0,0,8,16,100,0,"GRRRR" 25 | -------------------------------------------------------------------------------- /RogueSurvivor/Engine/HiScore.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.HiScore 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System; 8 | 9 | namespace djack.RogueSurvivor.Engine 10 | { 11 | [Serializable] 12 | internal class HiScore 13 | { 14 | public readonly string Name; 15 | public readonly int TotalPoints; 16 | public readonly int DifficultyPercent; 17 | public readonly int SurvivalPoints; 18 | public readonly int KillPoints; 19 | public readonly int AchievementPoints; 20 | public readonly int TurnSurvived; 21 | public readonly TimeSpan PlayingTime; 22 | public readonly string SkillsDescription; 23 | public readonly string Death; 24 | 25 | // default constructor 26 | public HiScore() 27 | { 28 | Death = "no death"; 29 | DifficultyPercent = 0; 30 | KillPoints = 0; 31 | Name = "no one"; 32 | PlayingTime = TimeSpan.Zero; 33 | SurvivalPoints = 0; 34 | TotalPoints = 0; 35 | TurnSurvived = 0; 36 | SkillsDescription = "no skills"; 37 | } 38 | 39 | public HiScore(Scoring sc, ActorScoring asc, string skillsDescription) 40 | { 41 | #if DEBUG 42 | if (null == sc) throw new ArgumentNullException(nameof(sc)); 43 | if (null == asc) throw new ArgumentNullException(nameof(asc)); 44 | #endif 45 | AchievementPoints = asc.AchievementPoints; 46 | Death = asc.DeathReason; 47 | DifficultyPercent = (int)(100.0 * asc.DifficultyRating); 48 | KillPoints = asc.KillPoints; 49 | Name = asc.Name; 50 | PlayingTime = sc.RealLifePlayingTime; 51 | SkillsDescription = skillsDescription; 52 | SurvivalPoints = asc.SurvivalPoints; 53 | TotalPoints = asc.TotalPoints; 54 | TurnSurvived = asc.TurnsSurvived; 55 | } 56 | 57 | public bool is_valid() 58 | { 59 | if (string.IsNullOrEmpty(Death)) return false; 60 | if (0 > DifficultyPercent) return false; 61 | if (0 > KillPoints) return false; 62 | if (string.IsNullOrEmpty(Name)) return false; 63 | // if ( ... PlayingTime) return false; 64 | if (0 > SurvivalPoints) return false; 65 | if (0 > TotalPoints) return false; 66 | if (0 > TurnSurvived) return false; 67 | if (string.IsNullOrEmpty(SkillsDescription)) return false; 68 | return true; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /RogueSurvivor/Zaimoni/Data/Stack.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Zaimoni.Data 6 | { 7 | public ref struct Stack // note namespace collision w/C# standard library 8 | { 9 | private readonly Span _x; 10 | private int ub; 11 | 12 | public Stack(Span src) { _x = src; ub = 0; } 13 | public void push(ref T src) { _x[ub++] = src; } 14 | public void push(T src) { _x[ub++] = src; } 15 | public int Count { get { return ub; } } 16 | public void Clear() { ub = 0; } 17 | public T this[int n] { get { return _x[n]; } } 18 | 19 | public Value Min(Func xform) where Value:IComparable 20 | { 21 | Value ret = (Value)typeof(Value).GetField("MaxValue").GetValue(default(Value)); 22 | int i = ub; 23 | Value test; 24 | while (0 <= --i) { 25 | if (0 < ret.CompareTo(test = xform(_x[i]))) ret = test; 26 | } 27 | return ret; 28 | } 29 | 30 | public Value Max(Func xform) where Value : IComparable 31 | { 32 | Value ret = (Value)typeof(Value).GetField("MinValue").GetValue(default(Value)); 33 | int i = ub; 34 | Value test; 35 | while (0 <= --i) { 36 | if (0 > ret.CompareTo(test = xform(_x[i]))) ret = test; 37 | } 38 | return ret; 39 | } 40 | 41 | public void SelfFilter(Predicate test) 42 | { 43 | if (0 < ub) { 44 | int origin = 0; 45 | int i = 0; 46 | do if (test(_x[i])) { 47 | if (origin < i) _x[origin++] = _x[i]; 48 | else origin++; 49 | } 50 | while(++i < ub); 51 | ub = origin; 52 | } 53 | } 54 | } 55 | 56 | static internal class Stack_ext 57 | { 58 | static public bool Contains(this ref Zaimoni.Data.Stack src, T x) where T : IComparable 59 | { 60 | int i = src.Count; 61 | while (0 < i--) if (0==x.CompareTo(src[i])) return true; 62 | return false; 63 | } 64 | 65 | static public Stack ToZStack(this IEnumerable src, Predicate test) 66 | { 67 | int ub; 68 | if (null == src || 0 >= (ub = src.Count())) return default; 69 | var ret = new Stack(new T[ub]); 70 | foreach (var x in src) if (test(x)) ret.push(x); 71 | return ret; 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /RogueSurvivor/Engine/CSVParser.cs: -------------------------------------------------------------------------------- 1 | // Decompiled with JetBrains decompiler 2 | // Type: djack.RogueSurvivor.Engine.CSVParser 3 | // Assembly: RogueSurvivor, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null 4 | // MVID: D2AE4FAE-2CA8-43FF-8F2F-59C173341976 5 | // Assembly location: C:\Private.app\RS9Alpha.Hg\RogueSurvivor.exe 6 | 7 | using System.Collections.Generic; 8 | using System.Text; 9 | 10 | namespace djack.RogueSurvivor.Engine 11 | { 12 | public class CSVParser 13 | { 14 | private readonly char m_Delimiter; 15 | 16 | public char Delimiter { get { return m_Delimiter; } } 17 | 18 | public CSVParser() 19 | { 20 | m_Delimiter = ','; 21 | } 22 | 23 | public string[] Parse(string line) 24 | { 25 | if (line == null) return new string[0]; 26 | line = line.TrimEnd(); 27 | List stringList = new List(line.Split(m_Delimiter)); 28 | int index1 = 0; 29 | do { 30 | string str1 = stringList[index1]; 31 | if ('"' == str1[0] && '"' != str1[^1]) { 32 | string str2 = str1; 33 | int index2 = index1 + 1; 34 | while (index2 < stringList.Count) { 35 | string str3 = stringList[index2]; 36 | str2 = str2 + "," + str3; 37 | stringList.RemoveAt(index2); 38 | if ('"' == str3[^1]) break; 39 | } 40 | stringList[index1] = str2; 41 | } else 42 | ++index1; 43 | } 44 | while (index1 < stringList.Count - 1); 45 | return stringList.ToArray(); 46 | } 47 | 48 | public List Parse(string[] lines) 49 | { 50 | int ub = (lines?.Length) ?? 0; 51 | if (0 >= ub) return new List(); 52 | var strArrayList = new List(ub); 53 | foreach (string line in lines) 54 | strArrayList.Add(Parse(line)); 55 | return strArrayList; 56 | } 57 | 58 | public CSVTable ParseToTable(string[] lines, int nbFields) 59 | { 60 | CSVTable csvTable = new CSVTable(nbFields); 61 | foreach (string[] strArray in Parse(lines)) { 62 | csvTable.AddLine(new CSVLine(strArray)); 63 | } 64 | return csvTable; 65 | } 66 | 67 | public string Format(string[] fields) 68 | { 69 | if (fields == null) return string.Format("{0}", (object)m_Delimiter); 70 | StringBuilder stringBuilder = new StringBuilder(); 71 | foreach (string field in fields) { 72 | stringBuilder.Append(field); 73 | stringBuilder.Append(m_Delimiter); 74 | } 75 | return stringBuilder.ToString(); 76 | } 77 | } 78 | } 79 | --------------------------------------------------------------------------------