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; }