/// <summary> /// Delete the black knight shield /// </summary> public void DeleteShield() { if (Ready) { DarkSouls.DeleteItem(BlackKnightShield); } }
/// <summary> /// Constructor /// </summary> public Model() : base(0, MIN_LIFE_SPAN, processSelector) // RefreshInterval at 0 because manually refreshed from the outside { Weapons = new List <BlackKnightWeapon>() { new BlackKnightWeapon(0x0, 355000, "Black Knight Greatsword", () => { return(DarkSouls.ReadEventFlag(11010862)); }), new BlackKnightWeapon(0x0, 1105000, "Black Knight Halberd", () => { return(DarkSouls.ReadEventFlag(11200816)); }), new BlackKnightWeapon(0x0, 310000, "Black Knight Sword", () => { return(DarkSouls.ReadEventFlag(11010861)); }), new BlackKnightWeapon(0x0, 753000, "Black Knight Greataxe", () => { return(DarkSouls.ReadEventFlag(11300859)); }) }; OnHooked += DarkSoulsProcess_OnHooked; OnUnhooked += DarkSoulsProcess_OnUnhooked; DeathProcessed = false; PreviousLoaded = false; }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { int x = spawnInfo.spawnTileX; int y = spawnInfo.spawnTileY; int tile = Main.tile[x, y].type; return((DarkSouls.NoZoneAllowWater(spawnInfo)) && Main.hardMode && y >= Main.rockLayer ? 0.1f : 0f); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { int x = spawnInfo.spawnTileX; int y = spawnInfo.spawnTileY; int tile = Main.tile[x, y].type; return(DarkSoulsWorld.downedAttraidies && DarkSouls.NoZoneAllowWater(spawnInfo) && Main.hardMode && !Main.dayTime && !spawnInfo.player.ZoneDungeon && y < Main.rockLayer ? 0.001f : 0f); }
/// <summary> /// Creates the currently selected weapon /// </summary> public void CreateWeapon() { if (Ready) { DarkSouls.CreateWeapon(SelectedWeapon); OnItemAcquired?.Invoke(this, EventArgs.Empty); } }
public void Debug() { bool alreadyOwns = DarkSouls.FindBlackKnightWeapon(SelectedWeapon); }
/// <summary> /// Main update loop that will automatically create and delete black knight weapons if needed /// </summary> /// <param name="createWeapon">If it should automatically create the weapon</param> /// <param name="deleteShield">If it should automatically delete the shield</param> public void UpdateLoop(bool createWeapon, bool deleteShield) { bool CurrentLoaded = Loaded; if (CurrentLoaded) { bool IsBlackKnightDead = SelectedWeapon.IsConditionSatisfied(); bool IsBlackKnightAlive = !IsBlackKnightDead; bool JustLoaded = !PreviousLoaded && CurrentLoaded; /** * If the black knight is still alive, we reset the state of the Weapon and Shield * Only checks after the player just loaded back in because it is the only * reliable moment */ if (JustLoaded && IsBlackKnightAlive) { DeathProcessed = false; } /** * Only run logic when the black is dead and only run that logic once, * until the black knight is alive again */ if (IsBlackKnightDead && !DeathProcessed) { // weapon if (createWeapon) { bool needsToCreate = !DarkSouls.FindBlackKnightWeapon(SelectedWeapon); if (needsToCreate) { /** * If the black knight is dead, the player doesn't have the * weapon and we didn't already gave it, then we give it */ CreateWeapon(); } } // shield if (deleteShield) { bool needsToDelete = DarkSouls.FindBlackKnightWeapon(BlackKnightShield); if (needsToDelete) { /** * If the black knight is dead and the player has the shield * so we need to delete it */ DeleteShield(); } } // only execute this once per black knight death DeathProcessed = true; } } PreviousLoaded = CurrentLoaded; }