public async Task <ThingData> GetData() { ThingData metadata = new ThingData() { AttributeDatas = new List <AttributeData>() }; var metadataResult = await StateManager.TryGetStateAsync <ThingMetaData>(MetadataState); if (metadataResult.HasValue) { metadata.ThingMetaData = metadataResult.Value; } else { metadata.ThingMetaData = new ThingMetaData { Name = "", ID = -1 }; } foreach (var attribute in actorProxyDictionary) { var attributeData = await attribute.Value.GetData(); metadata.AttributeDatas.Add(attributeData); } return(metadata); }
private void UpdateRotationAngles() { for (int i = 0; i < thingData.Count; i++) { ThingData td = thingData[i]; td.JitterRotation = (General.Random(-100, 100) / 100f); thingData[i] = td; } }
private void UpdateHeights() { for (int i = 0; i < thingData.Count; i++) { ThingData td = thingData[i]; td.JitterHeight = (General.Random(0, 100) / 100f); thingData[i] = td; } }
private void UpdateOffsetAngles() { for (int i = 0; i < thingData.Count; i++) { ThingData td = thingData[i]; td.OffsetAngle = General.Random(0, 359); thingData[i] = td; } }
private void UpdatePitchAngles() { int min = (cbNegativePitch.Checked ? -100 : 0); for (int i = 0; i < thingData.Count; i++) { ThingData td = thingData[i]; td.JitterPitch = (General.Random(min, 100) / 100f); thingData[i] = td; } }
private void UpdateScaleY() { int min = (cbNegativeScaleY.Checked ? -100 : 0); for (int i = 0; i < thingData.Count; i++) { ThingData td = thingData[i]; td.JitterScaleY = (General.Random(min, 100) / 100f); thingData[i] = td; } }
public async Task SetData(ThingData data) { // Validate parameter if (data == null) { return; } await StateManager.SetStateAsync(MetadataState, data.ThingMetaData); foreach (var attributeData in data.AttributeDatas) { var attribute = GetAttributeProxy(Id + attributeData.AttributeMetaData.Name); await attribute.SetData(attributeData); } }
// Fill the cell with non-Thing (non-Building) private static void TrySetCell_3_SetNonThing(IntVec3 c, Map map, ThingData nonthingData, ThingDef stuffDef) //, ThingDef stuffDef = null) { if (nonthingData == null) { return; } if (!Rand.Chance(nonthingData.Chance)) { return; } //Note: Here is no functionality to clear the cell by design, because it is possible to place items that are larger than 1x1 // 3rd step - work with the Non-Thing (Non-Buildings) if (nonthingData.Thing != null) { ThingDef thingDef = nonthingData.Thing; ThingDef stuffDef1 = stuffDef; if (nonthingData.Stuff.Count > 0) { float value = Rand.Value; foreach (var pair in nonthingData.Stuff.OrderBy(pair => pair.Value)) { if (value < pair.Value) { stuffDef1 = pair.Key; break; } } } if (!thingDef.MadeFromStuff) { stuffDef1 = null; } Thing newThing = ThingMaker.MakeThing(thingDef, stuffDef1); //if (thingRot == null || thingRot == Rot4.Invalid) GenSpawn.Spawn(newThing, c, map); //else // GenSpawn.Spawn(newThing, c, map, thingRot); } }
// Fill the cell with Floor private static void TrySetCell_1_SetFloor(IntVec3 c, Map map, ThingData terrainData = null, ThingDef thingDef = null, ThingDef stuffDef = null) { if (terrainData == null) { return; } if (!Rand.Chance(terrainData.Chance)) { return; } //Note: Here is no functionality to clear the cell by design, because it is possible to place items that are larger than 1x1 // 1st step - work with the Terrain if (terrainData.Terrain != null) { map.terrainGrid.SetTerrain(c, terrainData.Terrain); } else if (terrainData.Terrain == null && thingDef != null && stuffDef != null) {// Do ONLY when a thing will be placed here! map.terrainGrid.SetTerrain(c, BaseGenUtility.CorrespondingTerrainDef(stuffDef, true)); } }
// Fill the cell with Item private static void TrySetCell_4_SetItem(IntVec3 c, Map map, ThingData itemData = null) { //Note: Here is no functionality to clear the cell by design, because it is possible to place items that are larger than 1x1 // The following needs blueprint data to work if (itemData == null) { return; } // 4th step - work with the Item //if (itemDef != null) // && blueprint.itemSpawnChance / 100 > Rand.Value) if (itemData.Thing != null && itemData.Chance > Rand.Value) { ThingDef itemDef = itemData.Thing; ThingDef stuffDef2 = null; if (itemDef.MadeFromStuff) { if (itemData.Stuff.Count > 0) { float value = Rand.Value; foreach (var pair in itemData.Stuff.OrderBy(pair => pair.Value)) { if (value < pair.Value) { stuffDef2 = pair.Key; break; } } } else { if (itemDef.IsApparel) { if (!DefDatabase <ThingDef> .AllDefs.Where <ThingDef>(t => t.IsStuff && t.stuffProps != null && t.stuffProps.categories != null && t.stuffProps.categories.Contains(StuffCategoryDefOf.Fabric)) .TryRandomElement(out stuffDef2)) { stuffDef2 = DefDatabase <ThingDef> .GetNamedSilentFail("Synthread"); } } else { List <string> stuffPossibles = new List <string>() { "Steel", "Steel", "Steel", "Steel", "Silver", "Gold", "Jade", "Plasteel" }; stuffDef2 = DefDatabase <ThingDef> .GetNamedSilentFail(stuffPossibles.RandomElement()); } } } Thing newItem = TryGetTreasure(itemDef, stuffDef2, itemData); newItem = GenSpawn.Spawn(newItem, c, map); // Don't forget to set the items to forbidden! if (newItem.TryGetComp <CompForbiddable>() != null) { newItem.SetForbidden(true, false); } } }
// Fill the cell with Thing (Building) private static void TrySetCell_2_SetThing(IntVec3 c, Map map, Faction faction, ThingData thingData, Rot4 thingRot, ThingDef stuffDef = null) { if (thingData == null) { return; } if (!Rand.Chance(thingData.Chance)) { return; } //Note: Here is no functionality to clear the cell by design, because it is possible to place items that are larger than 1x1 // 2nd step - work with the Thing (Buildings) if (thingData.Thing != null) { ThingDef thingDef = thingData.Thing; ThingDef stuffDef1 = null; if (thingData.Stuff.Count > 0) { float value = Rand.Value; foreach (var pair in thingData.Stuff.OrderBy(pair => pair.Value)) { if (value < pair.Value) { stuffDef1 = pair.Key; break; } } } if (stuffDef1 == null) { stuffDef1 = stuffDef; } if (!thingDef.MadeFromStuff) { stuffDef1 = null; } Thing newThing = ThingMaker.MakeThing(thingDef, stuffDef1); if (thingData.Quality.Count > 0) { var comp = newThing.TryGetComp <CompQuality>(); if (comp != null) { float value = Rand.Value; foreach (var pair in thingData.Quality.OrderBy(pair => pair.Value)) { if (value < pair.Value) { comp.SetQuality(pair.Key, ArtGenerationContext.Outsider); break; } } } } if (thingRot == null || thingRot == Rot4.Invalid) { newThing = GenSpawn.Spawn(newThing, c, map); } else { newThing = GenSpawn.Spawn(newThing, c, map, thingRot); } // Set it to the current faction newThing.SetFactionDirect(faction); // If CompGatherSpot -> disable it! CompGatherSpot compGathering = newThing.TryGetComp <CompGatherSpot>(); if (compGathering != null) { compGathering.Active = false; } CompRefuelable compRefuelable = newThing.TryGetComp <CompRefuelable>(); if (compRefuelable != null) { compRefuelable.Refuel(compRefuelable.Props.fuelCapacity); } } }
private static void MakeBlueprintObject(Map map, Faction faction, CellRect mapRect, BaseBlueprintDef blueprint, ThingDef stuffDef, out Dictionary <Pawn, LordType> pawns, out float totalThreat, bool useOneFaction = false, bool useAddtionalThreat = false, float additionalPoints = 0f) { blueprint.buildingData = GetCleanedBlueprintData(blueprint.buildingData); blueprint.nonbuildingData = GetCleanedBlueprintData(blueprint.nonbuildingData); blueprint.floorData = GetCleanedBlueprintData(blueprint.floorData); blueprint.pawnData = GetCleanedBlueprintData(blueprint.pawnData); blueprint.itemData = GetCleanedBlueprintData(blueprint.itemData); pawns = null; totalThreat = 0; if (blueprint.buildingData == null && blueprint.nonbuildingData == null && blueprint.floorData == null) { Log.ErrorOnce(string.Format("After cleaning the BlueprintData and FloorData of blueprint {0} -> both are null, nothing will be done!", blueprint.defName), 313001); return; } IntVec3 spawnBaseCell = new IntVec3(mapRect.BottomLeft.x, mapRect.TopRight.y, mapRect.TopRight.z); IntVec3 spawnCell; //// Check all cells and abort if there is something indestructible found -> disabled //foreach (IntVec3 cell in mapRect) //{ // if (!CheckCell(cell, map)) // return; //} //allSpawnedPawns = null; // Disable automatic room updating map.regionAndRoomUpdater.Enabled = false; int step = 1; while (step <= 5) { //Log.Warning("Current step: " + step); // Work through blueprint - Note: top-left to bottom-right // Work step by step: 1st all floors, 2nd all things, 3rd all items, 4th all pawns for (int zn = 0; zn < blueprint.size.z; zn++) { for (int x = 0; x < blueprint.size.x; x++) { //// map can be clipped, don't work with the clipped parts //if (x > mapRect.Width - 1 || zn > mapRect.Height - 1) // continue; if (blueprint.canHaveHoles && Rand.Value < 0.08f) { continue; } spawnCell = spawnBaseCell + new IntVec3(x, 0, -zn); if (!TrySetCell_prepare_CheckCell(spawnCell, map)) { continue; } int itemPos = x + blueprint.size.x * zn; try { ThingData thingData = TryGetThingDefFromBuildingData(blueprint, itemPos); Rot4 thingRot = TryGetRotationFromBuildingData(blueprint, itemPos); ThingData nonthingData = TryGetThingDefFromNonBuildingData(blueprint, itemPos); ThingData terrainData = TryGetTerrainDefFromFloorData(blueprint, itemPos); ThingData pawnKindData = TryGetPawnKindDefFromPawnData(blueprint, itemPos); ThingData itemData = TryGetItemDefFromItemData(blueprint, itemPos); //List<Thing> list = map.thingGrid.ThingsListAt(spawnCell); //for (int i = 0; i < list.Count; i++) //{ // if (list[i].def == thingDef) // continue; //} //Only clear the space, if something will be made here // Do only in step 1: if (step == 1) { if (thingData?.Thing != null || terrainData?.Terrain != null || pawnKindData?.Kind != null || itemData?.Thing != null) { ClearCell(spawnCell, map); } } switch (step) { case 1: // Terrain TrySetCell_1_SetFloor(spawnCell, map, terrainData, thingData?.Thing, stuffDef); break; case 2: // non-Building TrySetCell_3_SetNonThing(spawnCell, map, nonthingData, stuffDef); break; case 3: // Building TrySetCell_2_SetThing(spawnCell, map, faction, thingData, thingRot, stuffDef); break; case 4: // Item TrySetCell_4_SetItem(spawnCell, map, itemData); break; case 5: // Pawn TrySetCell_5_SetPawn(spawnCell, map, faction, pawnKindData, useOneFaction); break; default: return; } } catch (Exception ex) { Log.Warning("MapGeneratorFactionBase - Error while creating the blueprint (" + blueprint.defName + ")\n" + ex.Message + "\n" + ex.StackTrace); } } } step++; } // Update the powernets map.powerNetManager.UpdatePowerNetsAndConnections_First(); // Enable automatic room updating and rebuild all rooms map.regionAndRoomUpdater.Enabled = true; map.regionAndRoomUpdater.RebuildAllRegionsAndRooms(); HashSet <Room> rooms = new HashSet <Room>(); foreach (IntVec3 current in mapRect.Cells) { // Find all created rooms Room room = current.GetRoom(map); if (room != null && !room.TouchesMapEdge) { rooms.Add(room); } else { map.fogGrid.Unfog(current); } } if (!blueprint.FogRooms) { AddRoomCentersToRootsToUnfog(rooms.ToList()); } else { AddRoomsToFog(rooms.ToList(), map); } Lord lordDefend = null; Lord lordAttack = null; foreach (var pair in allSpawnedPawns) { switch (pair.Value) { case LordType.Defend: { if (lordDefend == null) { lordDefend = LordMaker.MakeNewLord(faction, new LordJob_DefendBase(faction, mapRect.CenterCell), map, null); lordDefend.numPawnsLostViolently = int.MaxValue; } lordDefend.AddPawn(pair.Key); break; } case LordType.Attack: { if (lordAttack == null) { lordAttack = LordMaker.MakeNewLord(faction, new LordJob_AssaultColony(faction, canTimeoutOrFlee: false), map, null); lordAttack.numPawnsLostViolently = int.MaxValue; } lordAttack.AddPawn(pair.Key); break; } } totalThreat += (int)pair.Key.kindDef.combatPower; } // Make additional pawns if these are not enough! if (useAddtionalThreat || blueprint.UseAdditionalThreat) { if (lordDefend == null) { lordDefend = LordMaker.MakeNewLord(faction, new LordJob_DefendBase(faction, mapRect.CenterCell), map, null); lordDefend.numPawnsLostViolently = int.MaxValue; } float total = blueprint.ThreatsPoints + additionalPoints; //Log.Warning("Info: Creating base pawns.."); PrepareBaseGen_PawnGroup(map, mapRect, faction, rooms.ToList(), lordDefend, total); } PrepareBaseGen_CampFires(map, mapRect, faction); BaseGen.Generate(); /* * if (allSpawnedPawns != null) * { * foreach (Pawn pawn in allSpawnedPawns) * pawnLord.AddPawn(pawn); * } */ pawns = allSpawnedPawns; //allSpawnedPawns = null; }
public JitterThingsForm(string editingModeName) { this.editingModeName = editingModeName; this.HelpRequested += JitterThingsForm_HelpRequested; InitializeComponent(); //have thing height? heightJitterAmmount.Enabled = General.Map.FormatInterface.HasThingHeight; bUpdateHeight.Enabled = General.Map.FormatInterface.HasThingHeight; //disable pitch/roll/scale? if (!General.Map.UDMF) { pitchAmmount.Enabled = false; rollAmmount.Enabled = false; bUpdatePitch.Enabled = false; bUpdateRoll.Enabled = false; scalegroup.Enabled = false; cbRelativePitch.Enabled = false; cbRelativeRoll.Enabled = false; cbNegativePitch.Enabled = false; cbNegativeRoll.Enabled = false; } //get selection selection = new List <Thing>(); if (editingModeName == "BaseVisualMode") { visualSelection = ((VisualMode)General.Editing.Mode).GetSelectedVisualThings(false); foreach (VisualThing t in visualSelection) { selection.Add(t.Thing); } } else { ICollection <Thing> list = General.Map.Map.GetSelectedThings(true); foreach (Thing t in list) { selection.Add(t); } } //update window header this.Text = "Randomize " + selection.Count + (selection.Count > 1 ? " things" : " thing"); //store intial properties thingData = new List <ThingData>(); foreach (Thing t in selection) { ThingData d = new ThingData(); Thing closest = MapSet.NearestThing(General.Map.Map.Things, t); if (closest != null) { d.SafeDistance = (int)Math.Round(Vector2D.Distance(t.Position, closest.Position)); } else { d.SafeDistance = 512; } if (d.SafeDistance > 0) { d.SafeDistance /= 2; } if (MaxSafeDistance < d.SafeDistance) { MaxSafeDistance = d.SafeDistance; } d.Position = t.Position; d.Angle = t.AngleDoom; d.Pitch = t.Pitch; d.Roll = t.Roll; d.ScaleX = t.ScaleX; d.ScaleY = t.ScaleY; if (General.Map.FormatInterface.HasThingHeight) { if (t.Sector == null) { t.DetermineSector(); } if (t.Sector != null) { d.SectorHeight = Math.Max(0, t.Sector.CeilHeight - (int)t.Height - t.Sector.FloorHeight); if (MaxSafeHeightDistance < d.SectorHeight) { MaxSafeHeightDistance = d.SectorHeight; } d.ZOffset = (int)t.Position.z; } } thingData.Add(d); } positionJitterAmmount.Maximum = MaxSafeDistance; heightJitterAmmount.Maximum = MaxSafeHeightDistance; //create undo General.Map.UndoRedo.ClearAllRedos(); General.Map.UndoRedo.CreateUndo("Randomize " + selection.Count + (selection.Count > 1 ? " things" : " thing")); //update controls UpdateOffsetAngles(); UpdateHeights(); UpdateRotationAngles(); UpdatePitchAngles(); UpdateRollAngles(); UpdateScaleX(); UpdateScaleY(); //apply settings cbRelativeScale.Checked = relativeScale; cbUniformScale.Checked = uniformScale; cbNegativeScaleX.Checked = allowNegativeScaleX; cbNegativeScaleY.Checked = allowNegativeScaleY; cbRelativePitch.Checked = relativePitch; cbRelativeRoll.Checked = relativeRoll; cbNegativePitch.Checked = allowNegativePitch; cbNegativeRoll.Checked = allowNegativeRoll; //add event listeners cbRelativeScale.CheckedChanged += cbRelativeScale_CheckedChanged; cbUniformScale.CheckedChanged += cbUniformScale_CheckedChanged; cbNegativeScaleX.CheckedChanged += cbNegativeScaleX_CheckedChanged; cbNegativeScaleY.CheckedChanged += cbNegativeScaleY_CheckedChanged; cbRelativePitch.CheckedChanged += cbRelativePitch_CheckedChanged; cbRelativeRoll.CheckedChanged += cbRelativeRoll_CheckedChanged; cbNegativePitch.CheckedChanged += cbNegativePitch_CheckedChanged; cbNegativeRoll.CheckedChanged += cbNegativeRoll_CheckedChanged; //disable controls if necessary if (uniformScale) { cbUniformScale_CheckedChanged(cbUniformScale, EventArgs.Empty); } //tricky way to actually store undo information... foreach (Thing t in selection) { t.Move(t.Position); } }
static void Main(string[] args) { int number_of_device = 10; ////IActor1 actor = ActorProxy.Create<IActor1>(ActorId.CreateRandom(), new Uri("fabric:/Application1/Actor1ActorService")); ////System.Threading.Tasks.Task<string> retval = actor.GetHelloWorldAsync(); ////Console.Write(retval.Result); ////Console.ReadLine(); IThing[] things = new IThing[number_of_device]; for (int i = 1; i <= number_of_device; i++) { ThingData chillerConfigData = new ThingData(); chillerConfigData.ThingMetaData = new ThingMetaData() { ID = i, Name = "Device" + i }; var attributeList = new List <AttributeData>(); chillerConfigData.AttributeDatas = attributeList; AddAttribute(attributeList, chillerConfigData.ThingMetaData.Name, "Temperature", chillerConfigData.ThingMetaData.Name + "Temperature", "Temperature", DataType.Double, "F", 0, CreateTempLimitData()); AddAttribute(attributeList, chillerConfigData.ThingMetaData.Name, "Humidity", chillerConfigData.ThingMetaData.Name + "Humidity", "Humidity", DataType.Double, "%", 0, CreateHumidityLimitData()); AddAttribute(attributeList, chillerConfigData.ThingMetaData.Name, "Pressure", chillerConfigData.ThingMetaData.Name + "Humidity", "Pressure", DataType.Double, "psi", 0, CreatePresureLimitData()); IThing actor1 = ActorProxy.Create <IThing>(new ActorId(chillerConfigData.ThingMetaData.ID), new Uri("fabric:/Application1/ThingActorService")); actor1.SetData(chillerConfigData); things[i - 1] = actor1; } Console.Write("Deplyment is done"); for (int i = 1; i <= number_of_device; i++) { /////IThing actor1 = ActorProxy.Create<IThing>(new ActorId(i), new Uri("fabric:/Application1/ThingActorService")); var actor1 = things[i - 1]; Task <ThingData> model = actor1.GetData(); ThingData data = (ThingData)model.Result; Console.Write(data.ThingMetaData.ID + ":" + data.ThingMetaData.Name + "\n"); } Console.ReadLine(); /* * IThing device1 = ActorProxy.Create<IThing>(new ActorId(1), new Uri("fabric:/Application1/ThingActorService")); * var chiller1 = new Chiller("1", "Device1"); * chiller1.SimulateData(); * var runtimeDatas = chiller1.AttributeRuntimeDatas.Values; * ////Task<bool> retval1 = device1.ProcessEventAsync(runtimeDatas); * ////Console.Write(retval1.Result); * * List<AttributeRuntimeData> attributeRuntimeDatas = new List<AttributeRuntimeData>(); * foreach (var data in chiller1.AttributeRuntimeDatas.Values) * { * attributeRuntimeDatas.Add(data); * } */ ////AttributeRuntimeData attributeRuntime = new AttributeRuntimeData(); ////attributeRuntime.Name = "Temperature"; ////attributeRuntime.dqt = new DataQualityTimestamp() ////{ //// Value = 50, //// Timestamp = DateTime.UtcNow, //// Status = "Good" ////}; //attributeRuntimeDatas.Add(attributeRuntime); ///device1.ProcessEventAsync(attributeRuntimeDatas); ////ISampleScriptActor script = ActorProxy.Create<ISampleScriptActor>(new ActorId(Guid.NewGuid()), new Uri("fabric:/Application1/SampleScriptActorService")); ////while (true) ////{ //// Console.ReadLine(); //// Console.Write(script.GetValueOfB().Result); ////} }
// Fill the cell with Pawn private static void TrySetCell_5_SetPawn(IntVec3 c, Map map, Faction faction, ThingData pawnKindData = null, bool useOneFaction = false) { //Note: Here is no functionality to clear the cell by design, because it is possible to place items that are larger than 1x1 // The following needs blueprint data to work if (pawnKindData == null) { return; } // 5th step - work with the Pawn if (pawnKindData.Kind != null && pawnKindData.Chance > Rand.Value) { if (!useOneFaction) { if (pawnKindData.Faction != null) { faction = Find.FactionManager.FirstFactionOfDef(pawnKindData.Faction); } // null - find a valid faction. if (faction == null) { if ((from fac in Find.FactionManager.AllFactions where fac.HostileTo(Faction.OfPlayer) select fac).TryRandomElementByWeight((Faction fac) => 101 - fac.def.RaidCommonalityFromPoints(map.IncidentPointsRandomFactorRange.RandomInRange), out faction) == false) { faction = Faction.OfMechanoids; } } } int count = 1; if (pawnKindData.Count.max > 1) { if (pawnKindData.Count.min == pawnKindData.Count.max) { count = pawnKindData.Count.max; } else { count = Rand.RangeInclusive(pawnKindData.Count.min, pawnKindData.Count.max); } } for (int i = 0; i < count; i++) { Pawn pawn = PawnGenerator.GeneratePawn(pawnKindData.Kind, faction); //pawn.mindState.Active = true; pawn = GenSpawn.Spawn(pawn, c, map) as Pawn; if (pawn != null) { if (allSpawnedPawns == null) { allSpawnedPawns = new Dictionary <Pawn, LordType>(); } allSpawnedPawns.Add(pawn, pawnKindData.LordType); } } } }
private static Thing TryGetTreasure(ThingDef treasureDef, ThingDef stuffDef, ThingData itemData) { Thing treasure = null; // make treasure if (treasureDef == null) { return(null); } treasure = ThingMaker.MakeThing(treasureDef, stuffDef); if (itemData.Quality.Count > 0) { var comp = treasure.TryGetComp <CompQuality>(); if (comp != null) { float value = Rand.Value; foreach (var pair in itemData.Quality.OrderBy(pair => pair.Value)) { if (value < pair.Value) { comp.SetQuality(pair.Key, ArtGenerationContext.Outsider); break; } } } } /*// try adjust quality * CompQuality treasureQuality = treasure.TryGetComp<CompQuality>(); * if (treasureQuality != null) * treasureQuality.SetQuality(QualityUtility.GenerateQualityRandomEqualChance(), ArtGenerationContext.Outsider); */ // adjust Stack to a random stack size if (treasure.def.stackLimit > 1) { if (itemData.Count != null) { if (itemData.Count.min == itemData.Count.max) { treasure.stackCount = itemData.Count.max; } else { treasure.stackCount = Rand.RangeInclusive(itemData.Count.min, itemData.Count.max); } } if (treasure.stackCount > treasure.def.stackLimit) { treasure.stackCount = treasure.def.stackLimit; } /* * if (treasure.def.stackLimit > 50) * treasure.stackCount = Rand.RangeInclusive(1, 45); * else * treasure.stackCount = Rand.RangeInclusive(1, treasure.def.stackLimit); */ } /* * // adjust Hitpoints (40% to 100%) * if (treasure.stackCount == 1) * treasure.HitPoints = Rand.RangeInclusive((int)(treasure.MaxHitPoints * 0.4), treasure.MaxHitPoints); */ if (treasure.stackCount == 1) { if (itemData.HealthRange != null) { treasure.HitPoints = Rand.RangeInclusive(itemData.HealthRange.min, itemData.HealthRange.max); } else { treasure.HitPoints = Rand.RangeInclusive((int)(treasure.MaxHitPoints * 0.4), treasure.MaxHitPoints); } if (treasure.HitPoints > treasure.def.BaseMaxHitPoints) { treasure.HitPoints = treasure.def.BaseMaxHitPoints; } } return(treasure); }
public ReportReasonInputViewModel(ThingData thingData) : base("reason for the report", "", Enumerable.Empty<string>(), null) { _thingData = thingData; Dismissed = new GalaSoft.MvvmLight.Command.RelayCommand<string>(OnDismissed); }