Exemple #1
0
        public static void roll_to_hit(Pawn rapist, Pawn p)
        {
            if (!Mod_Settings.prisoner_beating)
            {
                return;
            }

            float rand_value  = Rand.Value;
            float victim_pain = p.health.hediffSet.PainTotal;
            // bloodlust makes the aggressor more likely to hit the prisoner
            float beating_chance = xxx.config.base_chance_to_hit_prisoner * (xxx.is_bloodlust(rapist) ? 1.25f : 1.0f);
            // psychopath makes the aggressor more likely to hit the prisoner past the significant_pain_threshold
            float beating_threshold = xxx.is_psychopath(rapist) ? xxx.config.extreme_pain_threshold : xxx.config.significant_pain_threshold;

            //--Log.Message("roll_to_hit:  rand = " + rand_value + ", beating_chance = " + beating_chance + ", victim_pain = " + victim_pain + ", beating_threshold = " + beating_threshold);
            if ((victim_pain < beating_threshold && rand_value < beating_chance) || (rand_value < (beating_chance / 2)))
            {
                //--Log.Message("   done told her twice already...");
                if (InteractionUtility.TryGetRandomVerbForSocialFight(rapist, out Verb v))
                {
                    rapist.meleeVerbs.TryMeleeAttack(p, v);
                }
            }

            /*
             * //if (p.health.hediffSet.PainTotal < xxx.config.significant_pain_threshold)
             * if ((Rand.Value < 0.50f) &&
             *      ((Rand.Value < 0.33f) || (p.health.hediffSet.PainTotal < xxx.config.significant_pain_threshold) ||
             *   (xxx.is_bloodlust (rapist) || xxx.is_psychopath (rapist)))) {
             *      Verb v;
             *      if (InteractionUtility.TryGetRandomVerbForSocialFight (rapist, out v))
             *              rapist.meleeVerbs.TryMeleeAttack (p, v);
             * }
             */
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_General.DoAtomic(delegate
            {
                Pawn pawn = job.targetA.Thing as Pawn;
                //if (pawn != null && pawn.Downed && base.pawn.mindState.duty != null && base.pawn.mindState.duty.attackDownedIfStarving && base.pawn.Starving())
                //{
                job.killIncappedTarget = true;
                //}
            }));

            yield return(Toils_Misc.ThrowColonistAttackingMote(TargetIndex.A));

            yield return(Toils_Combat.FollowAndMeleeAttack(TargetIndex.A, delegate
            {
                Thing thing = job.GetTarget(TargetIndex.A).Thing;
                Pawn p;
                //if (job.reactingToMeleeThreat && (p = (thing as Pawn)) != null && !p.Awake())
                //{
                //    EndJobWith(JobCondition.InterruptForced);
                //}
                InteractionUtility.TryGetRandomVerbForSocialFight(base.pawn, out Verb verb);
                if (BeatDecider.shouldStopBeating(base.pawn, base.TargetA.Thing as Pawn))
                {
                    EndJobWith(JobCondition.Succeeded);
                }
                else
                {
                    pawn.meleeVerbs.TryMeleeAttack(thing, verb);
                }
            }).FailOnDespawnedOrNull(TargetIndex.A));
Exemple #3
0
 public static Action GetAttackAction(Pawn pawn, LocalTargetInfo target, out string failStr)
 {
     failStr = "";
     if (!pawn.IsColonistPlayerControlled)
     {
         failStr = "CannotOrderNonControlledLower".Translate();
     }
     else if (target.IsValid && !pawn.CanReach(target, PathEndMode.Touch, Danger.Deadly))
     {
         failStr = "NoPath".Translate();
     }
     else if (pawn.WorkTagIsDisabled(WorkTags.Violent))
     {
         failStr = "IsIncapableOfViolenceLower".Translate(pawn.LabelShort, pawn);
     }
     else if (pawn.meleeVerbs.TryGetMeleeVerb(target.Thing) == null)
     {
         failStr = "Incapable".Translate();
     }
     else if (pawn == target.Thing)
     {
         failStr = "CannotAttackSelf".Translate();
     }
     else
     {
         Pawn target2;
         if ((target2 = (target.Thing as Pawn)) == null || (!pawn.InSameExtraFaction(target2, ExtraFactionType.HomeFaction) && !pawn.InSameExtraFaction(target2, ExtraFactionType.MiniFaction)))
         {
             return(delegate
             {
                 if (InteractionUtility.TryGetRandomVerbForSocialFight(pawn, out Verb verb))
                 {
                     Job job = JobMaker.MakeJob(jobDef, target.Thing as Pawn);
                     //job.maxNumMeleeAttacks = 1;
                     //job.killIncappedTarget = false;
                     Pawn pawn2 = target.Thing as Pawn;
                     if (pawn2 != null)
                     {
                         job.killIncappedTarget = pawn2.Downed;
                     }
                     //job.verbToUse = verb;
                     pawn.jobs.TryTakeOrderedJob(job);
                 }
                 //Job job = JobMaker.MakeJob(JobDefOf.AttackMelee, target);
                 //pawn.jobs.TryTakeOrderedJob(job);
             });
        public override Job TryGiveJob(Pawn pawn)
        {
            if (pawn.RaceProps.Humanlike && pawn.WorkTagIsDisabled(WorkTags.Violent))
            {
                return(null);
            }
            Pawn otherPawn = ((MentalState_Ork_Scrapping)pawn.MentalState).otherPawn;
            Verb verbToUse;

            if (!InteractionUtility.TryGetRandomVerbForSocialFight(pawn, out verbToUse))
            {
                return(null);
            }
            Job job = JobMaker.MakeJob(AdeptusJobDefOf.OGO_Orkoid_Scrap, otherPawn);

            job.maxNumMeleeAttacks = 1;
            job.verbToUse          = verbToUse;
            return(job);
        }
        public virtual void roll_to_hit(Pawn pawn, Pawn partner)
        {
            if (!RJWSettings.rape_beating || !xxx.is_human(pawn))
            {
                return;
            }

            //Rand.PopState();
            //Rand.PushState(RJW_Multiplayer.PredictableSeed());
            float rand_value    = Rand.Value;
            float victim_pain   = partner.health.hediffSet.PainTotal;
            float chance_to_hit = xxx.config.base_chance_to_hit_prisoner / 5;
            float threshold     = xxx.config.minor_pain_threshold;

            if ((victim_pain < threshold && rand_value < chance_to_hit))
            {
                if (InteractionUtility.TryGetRandomVerbForSocialFight(pawn, out Verb v))
                {
                    pawn.meleeVerbs.TryMeleeAttack(partner, v);
                }
            }
        }