public static bool Prefix(Survival __instance) { __instance.GetComponent <Player>().liveMixin.data.maxHealth = HCPSettings.Instance.HealthMax; __instance.GetComponent <Player>().liveMixin.health = HCPSettings.Instance.HealthMax * HCPSettings.Instance.HealthRespawnRatio; __instance.food = HCPSettings.Instance.FoodStart; __instance.water = HCPSettings.Instance.WaterStart; return(false); }
public void ShouldReturnName() { //assign ISkill actualSkillBase = new Survival(); //act ITextObj name = actualSkillBase.Name(); //assert name.Should().Be(new TextObj("Survival")); }
public void Bonus_SurvivalSpecified_ShouldWork() { SetupCharacter(); Skills survival = new Survival(true, true); Assert.AreEqual(-5, survival.Bonus); Assert.IsTrue(survival.Proficiency); Assert.IsTrue(survival.Expertise); }
public static void Postfix(Survival __instance, float damage) { float foodPerTempDamage = __instance.GetFoodPerTempDamage(); float value = __instance.food - damage * foodPerTempDamage; float min = __instance.GetMinStomachSize(); float max = __instance.GetStomachOverfillSize(); __instance.food = Mathf.Clamp(value, min, max); }
public static bool Prefix(ref Survival __instance) { if ((DeathRun.saveData.playerSave.startedGame > 0) && (DayNightCycle.main.timePassedAsFloat >= DeathRun.saveData.playerSave.startedGame + (5 * 60))) { __instance.food = Mathf.Clamp(__instance.food * .9f, 12f, 90.5f); __instance.water = Mathf.Clamp(__instance.water * .9f, 12f, 90.5f); return(false); } return(true); }
private void CalcSurvivalStats() { // Расчёт бонусов вынести в отдельный сервис, который покрыть модульными тестами // На вход принимает SurvivalData. SurvivalData дожен содержать метод увеличение диапазона характеристики. Survival.ResetStats(); for (var i = 0; i < EquipmentCarrier.Count(); i++) { var equipment = EquipmentCarrier[i]; if (equipment == null) { return; } var rules = equipment.Scheme.Equip.Rules; if (rules == null) { return; } foreach (var rule in rules) { switch (rule.Type) { case EquipCommonRuleType.Health: BonusToHealth(rule.Level, rule.Direction); break; case EquipCommonRuleType.HealthIfNoBody: var requirementsCompleted = true; for (var slotIndex = 0; slotIndex < EquipmentCarrier.Count(); slotIndex++) { if ((EquipmentCarrier.Slots[slotIndex].Types & EquipmentSlotTypes.Body) > 0) { if (EquipmentCarrier[slotIndex] != null) { requirementsCompleted = false; break; } } } if (requirementsCompleted) { BonusToHealth(rule.Level, rule.Direction); } break; } } } }
public void ShouldReturnWisdomAsBaseAttribute() { //arrange ISkill skill = new Survival(); ICharacterAttribute wisdomAttribute = new WisdomAttribute(); //act ICharacterAttribute actualAttribute = skill.BaseAttribute(); //assert actualAttribute.Should().Be(wisdomAttribute); }
public async Task <IActionResult> Create([Bind("Survivalid,Survivalprof")] Survival survival) { if (ModelState.IsValid) { _context.Add(survival); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(survival)); }
private void CalcSurvivalStats() { // Расчёт бонусов вынести в отдельный сервис, который покрыть модульными тестами // На вход принимает SurvivalData. SurvivalData дожен содержать метод увеличение диапазона характеристики. Survival.ResetStats(); var bonusList = new List <SurvivalStatBonus>(); FillSurvivalBonusesFromEquipments(ref bonusList); FillSurvivalBonusesFromPerks(ref bonusList); ApplySurvivalBonuses(bonusList); }
public ActionResult Create([Bind(Include = "Id,Intensity,Seeding,Area,SurvivalResult")] Survival survival) { if (ModelState.IsValid) { db.Survivals.Add(survival); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(survival)); }
internal static bool NotifyGetCanSleep(Player player) { if (DayNightCycle.main.IsInSkipTimeMode()) { return(false); } if (player.GetMode() != Player.Mode.Normal) { return(false); } if (player.isPiloting) { return(false); } if (player.movementSpeed != 0f) { return(false); } if (player.IsUnderwater() || player.IsSwimming() || player.IsUnderwaterForSwimming()) { ErrorMessage.AddWarning("You can not sleep in the water."); return(false); } if (SurvivalHelper.IsSurvival() && (StatManager.sleep.RealValue >= 100 || StatManager.tiredness.RealValue < 25 || StatManager.coffee.RealValue >= 20)) { if (StatManager.coffee.RealValue >= 20) { ErrorMessage.AddWarning("You shouldn't drink coffee before going to sleep!"); } else if (StatManager.sleep.RealValue >= 100 || StatManager.tiredness.RealValue < 25) { ErrorMessage.AddWarning("You aren't tired enough!"); } return(false); } Survival pSurvival = player.GetComponent <Survival>(); if (SurvivalHelper.IsSurvival() && (pSurvival.food <= 20f || pSurvival.water <= 20f)) { if (pSurvival.food <= 20f && pSurvival.water <= 20f) { ErrorMessage.AddWarning("You need to eat and drink something before going to sleep!"); } else if (pSurvival.food <= 20f) { ErrorMessage.AddWarning("You need to eat something before going to sleep!"); } else if (pSurvival.water <= 20f) { ErrorMessage.AddWarning("You need to drink something before going to sleep!"); } return(false); } return(true); }
public void ShouldReturnBonusOfBaseAttribute() { //arrange WisdomAttribute wisdomAttribute = new WisdomAttribute(new AttributeScore(14)); ISkill survival = new Survival(wisdomAttribute); IAttributeScore expectedScore = new AttributeScore(2); //act IAttributeScore actualScore = survival.SkillBonus(); //assert actualScore.Should().Be(expectedScore); }
public static bool Prefix(Survival __instance) { if (__instance.water <= 0) { DeathRun.setCause("Dehydration"); } else { DeathRun.setCause("Starvation"); } return(true); }
public static bool Prefix(ref Survival __instance, ref bool __result, GameObject useObj) { bool prefixFlag = true; if (useObj != null) { TechType techType = CraftData.GetTechType(useObj); NitrogenLevel nitrogenLevel = null; bool nFlag = false; if (Player.main.gameObject.GetComponent <NitrogenLevel>() != null) { nitrogenLevel = Player.main.gameObject.GetComponent <NitrogenLevel>(); if (nitrogenLevel.safeNitrogenDepth >= 10f) { nFlag = true; } } if (techType == TechType.FirstAidKit) { if (Player.main.GetComponent <LiveMixin>().AddHealth(50f) > 0.1f) { prefixFlag = false; __result = true; } if (nFlag) { if (nitrogenLevel.safeNitrogenDepth > 10f) { nitrogenLevel.safeNitrogenDepth -= 10f; } else { nitrogenLevel.safeNitrogenDepth = 0f; } prefixFlag = false; __result = true; } if (__result) { string useEatSound = CraftData.GetUseEatSound(techType); FMODUWE.PlayOneShot(useEatSound, Player.main.transform.position, 1f); } } } return(prefixFlag); }
// GET: Survivals/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Survival survival = db.Survivals.Find(id); if (survival == null) { return(HttpNotFound()); } return(View(survival)); }
public static void Postfix(Survival __instance, GameObject useObj) { if ((UnityEngine.Object)useObj != (UnityEngine.Object)null) { TechType tt = CraftData.GetTechType(useObj); if (TechType.Coffee == tt) { if (StatManager.coffee == null) { return; } StatManager.coffee.Value += 12.5f; } } }
// Update is called once per frame void FixedUpdate() { if (Input.GetMouseButtonDown(0) && started == false) { Survival sur = FindObjectOfType(typeof(Survival)) as Survival; sur.AStart(); AStart(); } if (started == true) { if (Loaded == null) { LoadSling(); } } }
private static void Postfix(Bed __instance, Player player) { player.liveMixin.health = player.liveMixin.maxHealth; player.liveMixin.health = player.liveMixin.maxHealth; Survival sv = player.GetComponent <Survival>(); float stoodUp = DayNightCycle.main.GetDayNightCycleTime(); float foodBefore = sv.food; float waterBefore = sv.water; float timeSlept = 0; if (wentToSleep > 0.5) { timeSlept = (((DayNightCycle.main.GetDayNightCycleTime() + 1) - wentToSleep)); } else { timeSlept = (((DayNightCycle.main.GetDayNightCycleTime() + 0) - wentToSleep)); } double hourTimeSlept = timeSlept / (1d / 24); double minuteTimeSlept = hourTimeSlept * 60; double looseFactor = 0.5; double foodLost = minuteTimeSlept / (25.20 * looseFactor); double waterLost = minuteTimeSlept / (18.00 * looseFactor); float foodAfter = foodBefore - (float)foodLost; float waterAfter = waterBefore - (float)waterLost; if (foodAfter > 5) { sv.food = foodAfter; } else { sv.food = 5; } if (waterAfter > 5) { sv.water = waterAfter; } else { sv.water = 5; } Main.Log("!!Left Bed:\nWent to Bed Time: " + wentToSleep + "\nWoke up: " + stoodUp + "\nDuration: " + timeSlept + "\nDuration in IGHours: " + hourTimeSlept + "\nDuration in IGMinutes: " + minuteTimeSlept + "\nFood Before: " + sv.food + "\nFood Lost: " + foodLost + "\nFood After: " + sv.food + "\nWater Before: " + waterBefore + "\nWater Lost: " + waterLost + "\nWater After: " + sv.water); }
internal static bool Prefix(Survival __instance) { weakness = 1; var weakSpeedThreshold = __instance.GetWeakSpeedThreshold(); if (__instance.food < __instance.GetLowFoodThreshold()) { weakness -= (weakSpeedThreshold - __instance.food) * 0.02f; } if (__instance.water < __instance.GetLowWaterThreshold()) { weakness -= (weakSpeedThreshold - __instance.water) * 0.02f; } return(false); }
/** * isIntroStillGoing() -- returns true if we're still on "press any key to continue" or during intro cinematic */ public static bool isIntroStillGoing() { // This checks if we're holding on the "press any key to continue" screen if (Player.main != null) { Survival surv = Player.main.GetComponent <Survival>(); if ((surv != null) && surv.freezeStats) { return(true); } } // Checks if opening animation is running if ((EscapePod.main == null) || ((EscapePod.main.IsPlayingIntroCinematic() && EscapePod.main.IsNewBorn()))) { return(true); } return(false); }
public ActionResult Test(String Intensity, String Area, String Seeding) { if (db.Survivals.Any(m => m.Intensity == Intensity && m.Area == Area && m.Seeding == Seeding)) { Survival validateInputModel = new Survival(); validateInputModel.SurvivalResult = db.Survivals.First(m => m.Intensity == Intensity && m.Area == Area && m.Seeding == Seeding).SurvivalResult; ViewBag.Test = validateInputModel.SurvivalResult; } else { ViewBag.Test = "Sorry we can't find the result, please enter again"; } return(View()); }
public static bool Prefix(Survival __instance, ref float __result, ref float timePassed) { if (HCPHelper.NextWarning == 0f) { HCPHelper.NextWarning = Time.time + 10; } float num = 0f; if (timePassed > 1.401298E-45f) { float prevVal = __instance.food; float prevVal2 = __instance.water; float num2 = (timePassed / 2520f * 100f) * HCPSettings.Instance.FoodDrainMultiplier; if (num2 > __instance.food) { num += (num2 - __instance.food) * HCPSettings.Instance.StarvationDamageMultiplier; } __instance.food = Mathf.Clamp(__instance.food - num2, 0f, HCPSettings.Instance.FoodOverchargeMax); float num3 = (timePassed / 1800f * 100f) * HCPSettings.Instance.WaterDrainMultiplier; if (num3 > __instance.water) { num += (num3 - __instance.water) * HCPSettings.Instance.DehydrationDamageMultiplier; } __instance.water = Mathf.Clamp(__instance.water - num3, 0f, HCPSettings.Instance.WaterMax); if (Time.time > HCPHelper.NextWarning) { MethodInfo warningSoundsMethod = __instance.GetType().GetMethod("UpdateWarningSounds", BindingFlags.NonPublic | BindingFlags.Instance); warningSoundsMethod.Invoke(__instance, new object[] { __instance.foodWarningSounds, __instance.food, prevVal, HCPSettings.Instance.FoodMax * 0.2f, HCPSettings.Instance.FoodMax * 0.1f }); warningSoundsMethod.Invoke(__instance, new object[] { __instance.waterWarningSounds, __instance.water, prevVal, HCPSettings.Instance.WaterMax * 0.2f, HCPSettings.Instance.WaterMax * 0.1f }); HCPHelper.NextWarning = Time.time + 10; } } __result = num; return(false); }
public void end() { Debug.Log("Game Over"); GameOver = true; if (ended == false) { if (GoodScore > PlayerPrefs.GetFloat("AnimalHighScore")) { PlayerPrefs.SetFloat("AnimalHighScore", GoodScore); } CancelInvoke(); Survival sur = FindObjectOfType(typeof(Survival)) as Survival; sur.CancelInvoke(); GameObject b = Instantiate(EndPanel) as GameObject; Canvas can = FindObjectOfType(typeof(Canvas)) as Canvas; b.transform.SetParent(can.transform); b.transform.localScale = new Vector3(1, 1, 1); b.transform.localPosition = new Vector3(0, 0, 0); ended = true; } }
public static bool Prefix(ref Survival __instance, ref bool __result, GameObject useObj) { usedSemaphore = false; if (useObj != null) { TechType techType = CraftData.GetTechType(useObj); if (techType == TechType.FirstAidKit) { NitrogenLevel nitrogenLevel = Player.main.gameObject.GetComponent <NitrogenLevel>(); if (DeathRun.saveData.nitroSave.safeDepth > 10f) { DeathRun.saveData.nitroSave.safeDepth /= 2; usedSemaphore = true; if (Time.time - ticksNotice > 60) { ticksNotice = Time.time; ErrorMessage.AddMessage("First Aid Kit helps purge Nitrogen from your bloodstream."); } if (DeathRun.saveData.nitroSave.safeDepth < 10f) { nitrogenLevel.nitrogenLevel = DeathRun.saveData.nitroSave.safeDepth * 10; } } else { if (nitrogenLevel.nitrogenLevel > 0) { nitrogenLevel.nitrogenLevel = 0; usedSemaphore = true; } } } } return(true); }
public void Update() { time += Time.deltaTime; // Only do on a specific cadence to avoid hammering server if (time >= INTERPOLATION_PERIOD) { time = 0; Survival survival = Player.main.GetComponent <Survival>(); if (survival != null && !survival.freezeStats) { float oxygen = Player.main.oxygenMgr.GetOxygenAvailable(); float maxOxygen = Player.main.oxygenMgr.GetOxygenCapacity(); float health = Player.main.liveMixin.health; float food = survival.food; float water = survival.water; float infectionAmount = Player.main.infectedMixin.GetInfectedAmount(); localPlayer.BroadcastStats(oxygen, maxOxygen, health, food, water, infectionAmount); } } }
private void NewPrefixPatch(Survival __instance, float timePassed) { totalFoodThirstDamage = 0f; const float minimumPastTime = 1.401298E-45f; if (minimumPastTime > timePassed) { return; } float startingFood = __instance.food; float startingWater = __instance.water; UpdateFood(__instance, timePassed); UpdateWater(__instance, timePassed); __instance.UpdateWarningSounds(__instance.foodWarningSounds, __instance.food, startingFood, __instance.GetLowFoodThreshold(), __instance.GetCriticalFoodThreshold()); __instance.UpdateWarningSounds(__instance.waterWarningSounds, __instance.water, startingWater, __instance.GetLowWaterThreshold(), __instance.GetCriticalWaterThreshold()); }
public Battle CreateSurvival(int limitNum, List <AccountData> accs) { Survival survival = new Survival(); survival.accounts = accs; survival.battleid = battleidCounter++; survival.limitNum = limitNum; survival.type = EBattle.Survival; //真随机 Random r = new Random(System.Guid.NewGuid().GetHashCode()); //为每个账号创建一个坦克 for (int i = 0; i < accs.Count; i++) { AccountData a = accs[i]; a.battleid = survival.battleid; Tank t = new Tank(); t.uid = a.account; t.nickName = a.nickname; t.hp = 100; t.color = new Color { r = (float)r.NextDouble(), g = (float)r.NextDouble(), b = (float)r.NextDouble(), }; t.pos = SpawnPoint.point[r.Next(0, 5)]; a.battleType = EBattle.Survival; survival.AddTank(t); } survivals.Add(survival); return(survival); }
public void Update() { time += Time.deltaTime; // Only do on a specific cadence to avoid hammering server if (time >= INTERPOLATION_PERIOD) { time = 0; Survival survival = Player.main.GetComponent <Survival>(); if (survival != null && !survival.freezeStats && GameModeUtils.IsOptionActive(GameModeOption.Survival)) { float oxygen = Player.main.oxygenMgr.GetOxygenAvailable(); float maxOxygen = Player.main.oxygenMgr.GetOxygenCapacity(); float health = Player.main.liveMixin.health; float food = survival.food; float water = survival.water; Multiplayer.Logic.Player.BroadcastStats(oxygen, maxOxygen, health, food, water); } } }
public void Update() { time += Time.deltaTime; // Only do on a specific cadence to avoid hammering server if (time >= interpolationPeriod) { time = 0; Survival survivial = Player.main.GetComponent <Survival>(); if (survivial != null) { float oxygen = Player.main.oxygenMgr.GetOxygenAvailable(); float maxOxygen = Player.main.oxygenMgr.GetOxygenCapacity(); float health = Player.main.liveMixin.health; float food = survivial.food; float water = survivial.water; Multiplayer.Logic.PlayerAttributes.BroadcastPlayerStats(oxygen, maxOxygen, health, food, water); } } }
public override JSONObject Serialize() { JSONObject obj = new JSONObject(); obj.Add(cAppraise, Appraise.Serialize()); obj.Add(cBalance, Balance.Serialize()); obj.Add(cBluff, Bluff.Serialize()); obj.Add(cClimb, Climb.Serialize()); obj.Add(cConcentration, Concentration.Serialize()); obj.Add(cDecipherScript, DecipherScript.Serialize()); obj.Add(cDiplomacy, Diplomacy.Serialize()); obj.Add(cDisableDevice, DisableDevice.Serialize()); obj.Add(cDisguise, Disguise.Serialize()); obj.Add(cEscapeArtist, EscapeArtist.Serialize()); obj.Add(cForgery, Forgery.Serialize()); obj.Add(cGatherInformation, GatherInformation.Serialize()); obj.Add(cHandleAnimal, HandleAnimal.Serialize()); obj.Add(cHeal, Heal.Serialize()); obj.Add(cHide, Hide.Serialize()); obj.Add(cIntimidate, Intimidate.Serialize()); obj.Add(cJump, Jump.Serialize()); obj.Add(cListen, Listen.Serialize()); obj.Add(cMoveSilently, MoveSilently.Serialize()); obj.Add(cOpenLock, OpenLock.Serialize()); obj.Add(cRide, Ride.Serialize()); obj.Add(cSearch, Search.Serialize()); obj.Add(cSenseMotive, SenseMotive.Serialize()); obj.Add(cSleightOfHand, SleightOfHand.Serialize()); obj.Add(cSpellCraft, SpellCraft.Serialize()); obj.Add(cSpot, Spot.Serialize()); obj.Add(cSurvival, Survival.Serialize()); obj.Add(cSwim, Swim.Serialize()); obj.Add(cTumble, Tumble.Serialize()); obj.Add(cUseMagicDevice, UseMagicDevice.Serialize()); obj.Add(cUseRope, UseRope.Serialize()); return(obj); }