Ejemplo n.º 1
0
        public void bSwitchUsingLiking()
        {
            double uSel  = sess.issue.computeUtility(voterBars[0].voter, voteOptBars[0].opt, new List <ReasonMsg>());
            double uCurr = sess.issue.computeUtility(voterBars[0].voter, voterBars[0].voter.getVote(sess), new List <ReasonMsg>());

            double utilityDelta = uCurr - uSel;

            if (utilityDelta < 0)
            {
                utilityDelta = 0;
            }
            double delta = (utilityDelta * world.map.param.voting_likingToSwitchPerU) + world.map.param.voting_likingToSwitchMin;

            RelObj rel = voterBars[0].voter.getRelation(agent);

            if (rel.getLiking() >= delta)
            {
                rel.addLiking(-delta, "Asked to switch vote", world.map.turn);
                world.audioStore.playActivate();
            }
            else
            {
                world.audioStore.playClick();
                world.prefabStore.popMsg(voterBars[0].voter.getFullName() + " does not like " + agent.getFullName() + " to agree to change to this voting option. Their liking is " + (int)(rel.getLiking())
                                         + " but you need " + (int)(delta));
                return;
            }
            voterBars[0].voter.forcedVoteOption  = voteOptBars[0].opt;
            voterBars[0].voter.forcedVoteSession = sess;
            checkData();
        }
        public override void castInner(Map map, Person victim)
        {
            Society soc = victim.society;

            victim.getRelation(map.overmind.enthralled).addLiking(-100, "Denounced me", map.turn);
            foreach (Person p in soc.people)
            {
                if (p == victim)
                {
                    continue;
                }
                if (p == map.overmind.enthralled)
                {
                    continue;
                }

                RelObj relEnth = p.getRelation(map.overmind.enthralled);
                RelObj relVic  = p.getRelation(victim);
                World.log(p.getFullName() + " check " + relVic.suspicion + " " + victim.evidence);
                if (relVic.suspicion < victim.evidence)
                {
                    double gain = victim.evidence - relVic.suspicion;
                    gain = Math.Max(0, gain); gain = Math.Min(1, gain);
                    //1 if you're revealling a fully evil person
                    gain = Math.Pow(gain, 0.4);      //Bring it closer to 1, get your money's worth

                    relEnth.suspicion *= (1 - gain); //Suspicion drops to 0 if you give up a 100% evidence person with no suspicion on them
                    relVic.suspicion  += gain;
                    if (relVic.suspicion > 1)
                    {
                        relVic.suspicion = 1;
                    }
                    relEnth.addLiking(gain * 25, "Revealled evidence of darkness", map.turn);
                    World.log(p.getFullName() + " gain " + gain);
                }
            }


            map.world.prefabStore.popImgMsg(
                "You denounce another, unexpectedly revealing the evidence of evil which they hold to the world. " +
                " By denouncing a villain, the suspicion towards your enthralled is reduced.",
                map.world.wordStore.lookup("SOC_DENOUNCE_OTHER"));
        }
        public override void process(Person p)
        {
            base.process(p);

            foreach (Person p2 in p.society.people)
            {
                if (p2 == p)
                {
                    continue;
                }
                RelObj rel = p.getRelation(p2);
                if (p2.prestige > p.prestige)
                {
                    if (rel.getLiking() > -100)
                    {
                        rel.addLiking(-100, "Grew envious due to higher prestige", p.map.turn);
                    }
                }
            }
            lashOut(p);
        }
Ejemplo n.º 4
0
        public override void turnTick(Unit unit)
        {
            if (unit.person == null)
            {
                unit.task = null; return;
            }
            if (unit.location.settlement == null)
            {
                unit.task = null; return;
            }
            if (unit.location.settlement.title == null)
            {
                unit.task = null; return;
            }
            if (unit.location.settlement.title.heldBy == null)
            {
                unit.task = null; return;
            }
            if (unit.location.soc is Society == false)
            {
                unit.task = null; return;
            }

            dur += 1;
            if (dur >= unit.location.map.param.unit_socialiseAtCourtTime)
            {
                Society soc         = (Society)unit.location.soc;
                double  maxPrestige = 0;
                foreach (Person p in soc.people)
                {
                    if (p.prestige > maxPrestige)
                    {
                        maxPrestige = p.prestige;
                    }
                }
                double prestige = unit.location.person().prestige;
                double scale    = 0;
                if (maxPrestige > 0)
                {
                    scale  = prestige / maxPrestige;
                    scale  = 1 - scale;//0 to 1, 1 if prestige is 0, 0 if prestige is MAX
                    scale *= 0.75;
                    scale += 0.25;
                }

                RelObj rel     = unit.location.settlement.title.heldBy.getRelation(unit.person);
                double maxGain = World.staticMap.param.unit_socialiseAtCourtGain;
                double delta   = maxGain * scale;
                delta = Math.Min(delta, 100 - rel.getLiking());
                if (delta < 0)
                {
                    delta = 0;
                }
                int iDelta = (int)(delta);

                rel.addLiking(iDelta, "Socialised at court", unit.location.map.turn);
                if (unit.isEnthralled())
                {
                    unit.location.map.world.prefabStore.popImgMsg(unit.getName() + " finishes socialising at court. " + unit.location.settlement.title.heldBy.getFullName() + "'s liking "
                                                                  + "for them increases by " + iDelta + " and is now " + ((int)rel.getLiking()), unit.location.map.world.wordStore.lookup("ABILITY_UNIT_SOCIALISE_AT_COURT"));
                }
                unit.task = null;
            }
        }