Added script for Friend of the Ninja mission (#406)

* Added script for Friend of the Ninja mission

* Added comments
This commit is contained in:
David Markowitz 2022-02-05 04:00:10 -08:00 committed by GitHub
parent 6ba9eea993
commit 828c457614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 0 deletions

View File

@ -145,6 +145,7 @@
#include "ImgBrickConsoleQB.h"
#include "ActParadoxPipeFix.h"
#include "FvNinjaGuard.h"
#include "FvPassThroughWall.h"
#include "FvBounceOverWall.h"
// FB Scripts
@ -557,6 +558,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = new ActParadoxPipeFix();
else if (scriptName == "scripts\\ai\\FV\\L_FV_NINJA_GUARDS.lua")
script = new FvNinjaGuard();
else if (scriptName == "scripts\\ai\\FV\\L_ACT_PASS_THROUGH_WALL.lua")
script = new FvPassThroughWall();
else if (scriptName == "scripts\\ai\\FV\\L_ACT_BOUNCE_OVER_WALL.lua")
script = new FvBounceOverWall();

View File

@ -0,0 +1,17 @@
#include "FvPassThroughWall.h"
#include "InventoryComponent.h"
void FvPassThroughWall::OnCollisionPhantom(Entity* self, Entity* target) {
auto missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent == nullptr) return;
//Because at the moment we do not have an ItemComponent component, we check to make sure a Maelstrom-Infused hood is equipped. There are only three in the game right now.
auto inventoryComponent = target->GetComponent<InventoryComponent>();
// If no inventory component is found then abort.
if (inventoryComponent == nullptr) return;
// If no Maelstrom hoods are equipped then abort.
if (!inventoryComponent->IsEquipped(WhiteMaelstromHood) && !inventoryComponent->IsEquipped(BlackMaelstromHood) && !inventoryComponent->IsEquipped(RedMaelstromHood)) return;
// Progress mission Friend of the Ninja since all prerequisites are met.
missionComponent->ForceProgress(friendOfTheNinjaMissionId, friendOfTheNinjaMissionUid, 1);
}

View File

@ -0,0 +1,34 @@
#pragma once
#include "CppScripts.h"
class FvPassThroughWall : public CppScripts::Script
{
/**
* @brief This method is called when there is a collision with self from target.
*
* @param self The Entity that called this method.
* @param target The Entity that self is targetting.
*/
void OnCollisionPhantom(Entity* self, Entity* target) override;
private:
/**
* Mission ID for Friend of the Ninjas.
*/
int32_t friendOfTheNinjaMissionId = 848;
/**
* Mission UID for Friend of the Ninjas.
*/
int32_t friendOfTheNinjaMissionUid = 1221;
/**
* Item LOT for Maelstrom-Infused White Ninja Hood
*/
int32_t WhiteMaelstromHood = 2641;
/**
* Item LOT for Maelstrom-Infused Black Ninja Hood
*/
int32_t BlackMaelstromHood = 2642;
/**
* Item LOT for Red Ninja Hood - Maelstrom Infused
*/
int32_t RedMaelstromHood = 1889;
};