public override void turnTick(Unit unit)
        {
            if (unit is Unit_Merchant == false)
            {
                unit.task = null; return;
            }
            if (unit.society is Society == false)
            {
                unit.task = null; return;
            }
            if (unit.location.settlement == null)
            {
                unit.task = null; return;
            }


            float         profit   = getSaleValue(unit.society, unit.location);
            Unit_Merchant merchant = (Unit_Merchant)unit;

            int sold = Math.Min(merchant.cargo, 10);

            merchant.cargo -= sold;
            if (merchant.cargo <= 0)
            {
                merchant.cargo = 0;
            }
            int gain = (int)(0.5f + (profit * sold));

            merchant.cash += gain;


            if (merchant.cash >= 100)
            {
                merchant.task = null;
                if (merchant.isEnthralled())
                {
                    merchant.location.map.world.prefabStore.popMsg(unit.getName() + " has generated as much wealth as they can transport, their strong-boxes brim with gold. They must spend before they can sell again.");
                }
            }
            if (merchant.cargo <= 0)
            {
                merchant.task = null;
                if (merchant.isEnthralled())
                {
                    merchant.location.map.world.prefabStore.popMsg(unit.getName() + " has sold all their cargo. They may now spend their profits or gather further cargo from home.");
                }
            }
        }
Exemple #2
0
        public override void turnTick(Unit unit)
        {
            if (unit is Unit_Merchant == false)
            {
                unit.task = null; return;
            }
            if (unit.society is Society == false)
            {
                unit.task = null; return;
            }
            if (unit.location.settlement == null)
            {
                unit.task = null; return;
            }
            if (unit.location.soc == null)
            {
                unit.task = null; return;
            }

            Unit_Merchant merchant = (Unit_Merchant)unit;

            if (merchant.cash <= 0)
            {
                unit.task = null; return;
            }

            merchant.cash -= 10;

            Person noble = merchant.location.person();

            if (noble != null)
            {
                noble.getRelation(merchant.person).addLiking(10, "Spent Wealth", unit.location.map.turn, RelObj.STACK_ADD);
                noble.prestige += 1.5;
            }
            if (unit.location.soc.currentMilitary < unit.location.soc.maxMilitary)
            {
                unit.location.soc.currentMilitary += 1;
                if (unit.location.soc.currentMilitary > unit.location.soc.maxMilitary)
                {
                    unit.location.soc.currentMilitary = unit.location.soc.maxMilitary;
                }
            }

            if (merchant.cash <= 0)
            {
                merchant.cash = 0;
                merchant.task = null;
                if (merchant.isEnthralled())
                {
                    merchant.location.map.world.prefabStore.popMsg(unit.getName() + " has spent their last wealth, and must now return home to collect more cargo to sell.");
                }
            }
        }
Exemple #3
0
        public override void turnTick(Unit unit)
        {
            if (unit is Unit_Merchant == false)
            {
                unit.task = null; return;
            }
            if (unit.society != unit.location.soc)
            {
                unit.task = null; return;
            }
            if (unit.location.settlement == null)
            {
                unit.task = null; return;
            }


            Unit_Merchant merchant = (Unit_Merchant)unit;

            if (unit.location.settlement is Set_City)
            {
                merchant.cargo += 30;
            }
            else
            {
                merchant.cargo += 15;
            }
            if (merchant.cargo >= 100)
            {
                merchant.cargo = 100;
                merchant.task  = null;
                if (merchant.isEnthralled())
                {
                    merchant.location.map.world.prefabStore.popMsg(unit.getName() + " has finished loading cargo");
                }
            }
        }