private bool _detectAttack(Map.MapData mapData) { if (mapData.Map[PosX, PosY] is Map.BreakableMapObject breakable) { if (breakable.Owner != Owner) { return(true); } } if (PosY == 0 || PosY == OsianLogic.LEN_Y - 1) { if (PosY != Owner.BasePosY) { return(true); } } foreach (var army in mapData.Army) { if (army.Owner != Owner && army.PosY == PosY && army.PosX == PosX) { return(true); } } return(false); }
private bool _detectAttack(Map.MapData mapData) { if (mapData.Map[PosX, PosY] is Map.BreakableMapObject breakable) { if (breakable.Owner != Owner) { return(true); } } if (PosY == 0 || PosY == OsianLogic.LEN_Y - 1) { if (PosY != Owner.BasePosY) { return(true); } } foreach (var army in mapData.Army) { if (army.Owner != Owner && army.PosY.IsInRange(PosY, PosY + AttackRange * Owner.Direction) && army.PosX == PosX) { if (army is Buster && army.PosY != PosY) { continue; } return(true); } } return(false); }
public virtual void MeleeMove(Map.MapData mapData) { for (int i = 0; i < Speed && !_detectAttack(mapData); i++) { _step(mapData); } _doAttack(mapData); }
public void Invoke(OsianPlayer player, Map.MapData mapData) { int x = Px; int y = Math.Abs(player.BasePosY - Py); x.XRangeCheck(); y.YRangeCheck(); player.Cost -= Cost; Action(player, mapData, x, y); }
public void InitSleepHud(MultiplayerSleepAndDeathScreen sleepAndDeathScreen, Map.MapData mapData, SlugcatStats charStats) { this.AddPart(new FoodMeter(this, charStats.maxFood, charStats.foodToHibernate)); //if (mapData != null) //{ //this.AddPart(new Map(this, mapData)); //} this.foodMeter.pos = new Vector2(sleepAndDeathScreen.FoodMeterXPos((sleepAndDeathScreen.ID != ProcessManager.ProcessID.SleepScreen) ? 1f : 0f), 0f); this.foodMeter.lastPos = this.foodMeter.pos; this.AddPart(new RainMeter(this, this.fContainers[1])); this.rainMeter.pos = new Vector2(this.rainWorld.options.ScreenSize.x - 335f, this.rainWorld.options.ScreenSize.y - 70f); this.rainMeter.lastPos = this.rainMeter.pos; this.rainMeter.fade = 1f; }
/// <summary> /// 次のレベルに移動する /// </summary> public void ChangeNextLevel(UnityEngine.Tilemaps.Tilemap tilemap, Map.MapData mapData, int level) { // 元のマップからPlayerを削除する var playerPos = PlayerModel.CellPosition.Value; _eventManager.Trigger(Map.EventTileFlagUpdate.CreateAtRemove(PlayerModel.MapLevel, playerPos.x, playerPos.y, Const.TileFlag.Player)); // 座標をもとに戻す ResetPlayerUpPosition(); PlayerModel.SetMapLevel(level, mapData); // 移動後のTilemapをPlayerに登録し直す Player.SetTilemap(tilemap, level); }
private void _doAttack(Map.MapData mapData) { AttackedThisFrame = false; foreach (var army in mapData.Army.ToArray()) { if (army.Owner != Owner && !(army is Buster) && army.PosY.IsInRange(PosY + Owner.Direction, PosY + Owner.Direction * AttackRange) && army.PosX == PosX) { army.HP -= Attack; AttackedThisFrame = true; if (army.HP <= 0) { mapData.Army.Remove(army); } if (!AOE) { break; } } } }
private void _doAttack(Map.MapData mapData) { foreach (var army in mapData.Army.ToArray()) { if (army.Owner != Owner && army.PosY == PosY && army.PosX == PosX) { int delta = Math.Min(army.HP, HP); HP -= delta; army.HP -= delta; if (army.HP <= 0) { mapData.Army.Remove(army); } if (HP <= 0) { break; } } } if (HP <= 0) { mapData.Army.Remove(this); } }
public abstract void Action(OsianPlayer player, Map.MapData mapData, int px, int py);
public void SetMapLevel(int mapLevel, Map.MapData mapData) { MapLevel = mapLevel; _mapData = mapData; }
public void InitSleepHud(SleepAndDeathScreen sleepAndDeathScreen, Map.MapData mapData, SlugcatStats charStats) { this.AddPart(new FoodMeter(this, charStats.maxFood, charStats.foodToHibernate)); this.foodMeter.pos = new Vector2(sleepAndDeathScreen.FoodMeterXPos((sleepAndDeathScreen.ID != ProcessManager.ProcessID.SleepScreen) ? 1f : 0f), 0f); this.foodMeter.lastPos = this.foodMeter.pos; if (mapData != null) { this.AddPart(new Map(this, mapData)); } int dayType; if ((this.owner as patch_SleepAndDeathScreen).nextcycleLength < 20000) { dayType = 1; } else if ((this.owner as patch_SleepAndDeathScreen).nextcycleLength < 28000) { dayType = 2; } else { dayType = 3; } this.AddPart(new KarmaMeter(this, this.fContainers[1], new IntVector2(dayType, 12), false)); this.karmaMeter.pos = new Vector2(this.rainWorld.options.ScreenSize.x - 280f, this.rainWorld.options.ScreenSize.y - 70f); this.karmaMeter.lastPos = this.karmaMeter.pos; this.karmaMeter.fade = 1f; if ((this.owner as patch_SleepAndDeathScreen).nextcycleLength2 < 20000) { dayType = 1; } else if ((this.owner as patch_SleepAndDeathScreen).nextcycleLength2 < 28000) { dayType = 2; } else { dayType = 3; } this.AddPart(new KarmaMeter(this, this.fContainers[1], new IntVector2(dayType, 12), false)); this.karmaMeter.pos = new Vector2(this.rainWorld.options.ScreenSize.x - 175f, this.rainWorld.options.ScreenSize.y - 70f); this.karmaMeter.lastPos = this.karmaMeter.pos; this.karmaMeter.fade = 1f; if ((this.owner as patch_SleepAndDeathScreen).nextcycleLength3 < 20000) { dayType = 1; } else if ((this.owner as patch_SleepAndDeathScreen).nextcycleLength3 < 28000) { dayType = 2; } else { dayType = 3; } this.AddPart(new KarmaMeter(this, this.fContainers[1], new IntVector2(dayType, 12), false)); this.karmaMeter.pos = new Vector2(this.rainWorld.options.ScreenSize.x - 70f, this.rainWorld.options.ScreenSize.y - 70f); this.karmaMeter.lastPos = this.karmaMeter.pos; this.karmaMeter.fade = 1f; this.AddPart(new RainMeter(this, this.fContainers[1])); this.rainMeter.pos = new Vector2(this.rainWorld.options.ScreenSize.x - 280f, this.rainWorld.options.ScreenSize.y - 70f); this.rainMeter.lastPos = this.rainMeter.pos; this.rainMeter.fade = 1f; this.AddPart(new RainMeter(this, this.fContainers[1])); this.rainMeter.pos = new Vector2(this.rainWorld.options.ScreenSize.x - 175f, this.rainWorld.options.ScreenSize.y - 70f); this.rainMeter.lastPos = this.rainMeter.pos; this.rainMeter.fade = 1f; this.AddPart(new RainMeter(this, this.fContainers[1])); this.rainMeter.pos = new Vector2(this.rainWorld.options.ScreenSize.x - 70f, this.rainWorld.options.ScreenSize.y - 70f); this.rainMeter.lastPos = this.rainMeter.pos; this.rainMeter.fade = 1f; }
private static void InitSleepHudHK(On.HUD.HUD.orig_InitSleepHud orig, HUD.HUD self, SleepAndDeathScreen sleepAndDeathScreen, Map.MapData mapData, SlugcatStats charStats) { if (!(sleepAndDeathScreen is MultiplayerSleepAndDeathScreen)) { Debug.Log("Calling orig ctor Sleeping Screen"); orig(self, sleepAndDeathScreen, mapData, charStats); return; } self.AddPart(new FoodMeter(self, charStats.maxFood, charStats.foodToHibernate)); //if (mapData != null) //{ //this.AddPart(new Map(this, mapData)); //} self.foodMeter.pos = new Vector2(sleepAndDeathScreen.FoodMeterXPos((sleepAndDeathScreen.ID != ProcessManager.ProcessID.SleepScreen) ? 1f : 0f), 0f); self.foodMeter.lastPos = self.foodMeter.pos; RainMeterMultiplayer rainMeter = new RainMeterMultiplayer(self, self.fContainers[1]); rainMeter.pos = new Vector2(self.rainWorld.options.ScreenSize.x - 335f, self.rainWorld.options.ScreenSize.y - 70f); self.AddPart(rainMeter); }
private static int MapData_KarmaOfGate(On.HUD.Map.MapData.orig_KarmaOfGate orig, Map.MapData self, PlayerProgression progression, World initWorld, string roomName) { // Gotta scan it all, progression was loaded on game-start and doesnt account for enabled/disabled regions ? foreach (KeyValuePair <string, string> keyValues in CustomWorldMod.activatedPacks) { CustomWorldMod.Log($"Custom Regions: Loading KarmaOfGate for {keyValues.Key}", false, CustomWorldMod.DebugLevel.FULL); string path = CustomWorldMod.resourcePath + keyValues.Value + Path.DirectorySeparatorChar; string path2 = path + "World" + Path.DirectorySeparatorChar + "Gates" + Path.DirectorySeparatorChar + "locks.txt"; if (File.Exists(path2)) { string[] array = File.ReadAllLines(path2); for (int i = 0; i < array.Length; i++) { string[] array2 = Regex.Split(array[i], " : "); if (array2[0] == roomName) { string req1 = array2[1]; string req2 = array2[2]; int result; int result2; result = Custom.IntClamp(int.Parse(req1) - 1, 0, 4); result2 = Custom.IntClamp(int.Parse(req2) - 1, 0, 4); bool flipped = false; if (roomName == "GATE_LF_SB" || roomName == "GATE_DS_SB" || roomName == "GATE_HI_CC" || roomName == "GATE_SS_UW") { flipped = true; } CustomWorldMod.Log($"Custom Regions: Found custom KarmaOfGate for {keyValues.Key}. Gate [{result}/{result2}]"); string[] namearray = Regex.Split(roomName, "_"); if (namearray[1] == initWorld.region.name != flipped) { return(result); } return(result2); } } } } return(orig(self, progression, initWorld, roomName)); }
private void _step(Map.MapData mapData) { PosY += Owner.Direction; }
public virtual void RangedAttack(Map.MapData mapData) { _doAttack(mapData); }