Example #1
0
    private void spawnARandomPirate()
    {
        GameObject origin      = randomDoor();
        GameObject destination = randomDoor();
        PirateType type        = GetRandomEnum <PirateType>();
        GameObject newGO       = GameObject.Instantiate(getPiratePrefab(type), origin.transform.position, origin.transform.rotation, transform);
        Pirate     newPirate   = newGO.GetComponent <Pirate>();

        newPirate.Destination = destination;
    }
Example #2
0
 private GameObject getPiratePrefab(PirateType type)
 {
     foreach (PiratePrefabEntry entry in piratePrefabs)
     {
         if (entry.type == type)
         {
             return(entry.prefab);
         }
     }
     Debug.Log("No Prefab for Pirate Type: " + type);
     return(null);
 }
 //0= sailor  1= warrior  2= slave  3= passenger 4= navigator 5= auger
 //A sailor is the base class--no benefits/detriments
 //	--navigators provide maps to different settlements and decrease negative random events
 //	--warriors make sure encounters with pirates or other raiding activities go better in your favor
 //	--slaves have zero clout--few benefits--but they never leave the ship unless they die
 public CrewMember(int ID, string name, int originCity, int clout, CrewType typeOfCrew, string backgroundInfo, bool isKillable, bool isPartOfMainQuest, bool isPirate, PirateType pirateType)
 {
     this.ID                = ID;
     this.name              = name;
     this.originCity        = originCity;
     this.clout             = clout;
     this.typeOfCrew        = typeOfCrew;
     this.backgroundInfo    = backgroundInfo;
     this.isKillable        = isKillable;
     this.isPartOfMainQuest = isPartOfMainQuest;
     this.isPirate          = isPirate;
     this.pirateType        = pirateType;
 }
Example #4
0
        public List <Pirate> GetPirateType(PirateType type)
        {
            var result = new List <Pirate>();

            foreach (var pirate in pirates)
            {
                if (pirate.Type == type)
                {
                    result.Add(pirate);
                }
            }
            return(result);
        }
    private void onPirateTurnedIn(System.Object args)
    {
        PirateTurnedInArgs pirateTurnedInArgs = (PirateTurnedInArgs)args;
        PirateType         turnInType         = pirateTurnedInArgs.TurnedInPirate.myType;

        if (thisBounty[turnInType] > 0)
        {
            thisBounty[turnInType] -= 1;
        }
        if (bountyIsComplete())
        {
            collectBounty();
        }
    }
Example #6
0
    //pirate ship builder template
    public PirateModel(SpaceModel location, PirateType type, int health, int shotDamage, int detectRange, int attackRange, int maxPirateMovement, int shotCounter, PirateAiModel pirateAi)
    {
        // The "base" for these are unnecessary, but it helps keep them seperate. Base gets the superclass
        base.currentSpace       = location;
        this.type               = type;
        base.shipHealth         = health;
        base.maxHealth          = health;
        base.shotDamage         = shotDamage;
        this.playerDetectRange  = detectRange;
        base.attackRange        = attackRange;
        base.maxMovement        = maxPirateMovement;
        base.currentMovement    = maxPirateMovement;
        base.shotCounter        = shotCounter;
        base.currentShotCounter = shotCounter;
        this.pirateAi           = pirateAi;

        base.shipArmor = 0;
    }
    private CrewMember CrewFromPirateHometown(PirateType pirate)
    {
        List <CrewMember> allPirates = Globals.GameVars.Pirates.Where(x => x.pirateType.Equals(pirate)).ToList();

        foreach (CrewMember c in Globals.GameVars.playerShipVariables.ship.crewRoster)
        {
            IEnumerable <Settlement> crewNetwork = Globals.GameVars.Network.GetCrewMemberNetwork(c);
            foreach (CrewMember p in allPirates)
            {
                if (crewNetwork.Contains(Globals.GameVars.GetSettlementFromID(p.originCity)))
                {
                    //Debug.Log($"{c.name} knows the home city of Pirate {p.name}: {Globals.GameVars.GetSettlementFromID(c.originCity).name}");
                    return(c);
                }
            }
        }

        return(null);
    }
    private void OnEnable()
    {
        if (rsp == null)
        {
            rsp = GetComponent <RandomSlotPopulator>();
        }
        cloutChange = 0;

        alreadyTriedRunning     = false;
        alreadyTriedNegotiating = false;

        foreach (ButtonExplanation button in negotiateButtons)
        {
            button.SetExplanationText("The pirates may let you go\nYou will be known as a coward");
            button.GetComponentInChildren <Button>().interactable = true;
        }

        //check true zones, out of those, have a pirate type spawn from one of the "true" areas
        //no pirates should appear if there aren't any actve zones
        if (Globals.GameVars.playerShipVariables.zonesList.Count > 0)
        {
            //below line is unneeded
            //int randomPirateTypeFromActiveZones = UnityEngine.Random.Range(1, Globals.GameVars.playerShipVariables.zonesList.Count);

            string randomPirateTypeName = Globals.GameVars.playerShipVariables.zonesList.RandomElement();

            PirateType theType = Globals.GameVars.PirateTypes.FirstOrDefault(t => t.name == randomPirateTypeName);
            //Debug.Log("theType = " + theType);
            rsp.SetPirateType(theType);
            //Debug.Log("Pirate type in game is: " + rsp.GetType());
        }
        else
        {
            //temporary code
            //rsp.SetPirateType(Globals.GameVars.PirateTypes.RandomElement());
        }

        runChance = CalculateRunChance();
        foreach (ButtonExplanation button in runButtons)
        {
            button.SetExplanationText($"{runChance * 100}% success chance\nYou will be known as a coward");
            button.GetComponentInChildren <Button>().interactable = true;
        }



        string     pirateTypeText = "";
        CrewMember pirateKnower   = CrewFromPirateHometown(rsp.CurrentPirates);

        if (pirateKnower != null)
        {
            string typeInfo = Globals.GameVars.pirateTypeIntroText[0];
            typeInfo = typeInfo.Replace("{0}", pirateKnower.name);
            typeInfo = typeInfo.Replace("{1}", rsp.CurrentPirates.name);

            //commented out the "1 + " to test for text matching up to type of Pirate in PMG
            //works as of 08/14/2020
            pirateTypeText = typeInfo + " " + Globals.GameVars.pirateTypeIntroText[/*1 + */ rsp.CurrentPirates.ID];
            Debug.Log("current pirate ID: " + rsp.CurrentPirates.ID);
        }
        else
        {
            pirateTypeText = $"You ask around your crew, but it doesn't seem like any of them are from the same region as the pirates. You think they may be {rsp.CurrentPirates.name}. " +
                             "Perhaps if you had more cities in your network you would have some advance warning of how they fight.";
        }

        mgInfo.gameObject.SetActive(true);
        mgInfo.DisplayText(
            Globals.GameVars.pirateTitles[0],
            Globals.GameVars.pirateSubtitles[0],
            Globals.GameVars.pirateStartText[0] + "\n\n" + pirateTypeText + "\n\n" + pirateInstructions + "\n\n" + Globals.GameVars.pirateStartText[UnityEngine.Random.Range(1, Globals.GameVars.pirateStartText.Count)],
            pirateIcon,
            MiniGameInfoScreen.MiniGame.Pirates);
    }
Example #9
0
 public Pirate(string name, PirateType type)
 {
     this.Name = name;
     this.Type = type;
 }
Example #10
0
 public void SetPirateType(PirateType t)
 {
     typeToSpawn = t;
     //Debug.Log($"Spawning only pirates of type {typeToSpawn.name}"); //<-- that type gets changed again later when the actual pirate cardds are loaded in (based on the zone(s) the player is currently in
 }
Example #11
0
 public void SetPirateType(PirateType t)
 {
     typeToSpawn = t;
 }
Example #12
0
 public Pirate(string name, double drunkLevel, PirateType type)
 {
     Name       = name;
     DrunkLevel = drunkLevel;
     Type       = type;
 }