Exemplo n.º 1
0
    void GenerateRaidOutcome(Raid r)
    {
        RaidSpawner.RaidInfo raidInfo = r.raidInfo;
        float       successRate       = raidInfo.successRate;
        float       successNum        = Random.Range(1f, 100f);
        RaidOutcome raidOutcome       = new RaidOutcome();

        if (successNum <= successRate)
        {
            raidOutcome.status     = RaidOutcomeStatus.Success;
            raidOutcome.goldAmount = raidInfo.goldAmount;
            float capturedNum = Random.Range(1f, 100f);
            float captureRate = raidInfo.captureChance;
            if (capturedNum <= captureRate)
            {
                raidOutcome.isCaptured = true;
            }
        }
        else
        {
            raidOutcome.status = RaidOutcomeStatus.Failure;
            float lossRate = Random.Range(1f, 100f);
            if (lossRate <= 10)
            {
                raidOutcome.isLost = true;
            }
        }
        raidOutcome.damageTaken = CalculateDamageTaken(r, successNum <= successRate);
        raidOutcome.crewLost    = CalculateCrewLost(r, successNum <= successRate);
        raidOutcome.raid        = r;
        raidOutcomes.Push(raidOutcome);
    }
Exemplo n.º 2
0
 public void SetRaidInfo(RaidSpawner.RaidInfo raidInfo)
 {
     duration.text    = "Raid Length: " + raidInfo.duration;
     goldAmount.text  = "Potential Gold Return: " + raidInfo.goldAmount + "G";
     successRate.text = "Success Rate: " + raidInfo.successRate + "%";
     captureRate.text = "Capture Rate: " + raidInfo.captureChance + "%";
     this.raidInfo    = raidInfo;
 }
Exemplo n.º 3
0
 public void StartRaid(Ship shipToRaid, RaidSpawner.RaidInfo raidInfo)
 {
     raidingShips.Add(new Raid {
         raider   = shipToRaidWith,
         target   = shipToRaid,
         raidInfo = raidInfo
     });
     CloseRaidTargetSelect();
 }