internal string HandleImpact(GameObject wielder, GameObject impacting, double force) { if (impacting.HasComponent(Text.CompPhysics)) { PhysicsComponent phys = (PhysicsComponent)impacting.GetComponent(Text.CompPhysics); double strikePenetration = phys.GetImpactPenetration(force, 1.0); if (strikePenetration > 0) { if (phys.edged) { return($"leaving a {strikePenetration}cm deep, bleeding wound"); } else { return($"leaving a {strikePenetration}cm deep bruise"); } } } return("to no effect"); }
internal void ExaminedBy(GameObject viewer, bool fromInside) { string mainDesc = $"{Colours.Fg(Text.Capitalize(shortDescription),Colours.BoldWhite)}."; if (parent.HasComponent(Text.CompMobile)) { string startingToken; string theyAre; string their; if (parent == viewer) { startingToken = "You're"; theyAre = "You're"; their = "Your"; } else { startingToken = "That's"; theyAre = $"{Text.Capitalize(parent.gender.He)} {parent.gender.Is}"; their = Text.Capitalize(parent.gender.His); } MobileComponent mob = (MobileComponent)parent.GetComponent(Text.CompMobile); mainDesc = $"{startingToken} {mainDesc}\n{theyAre} a {mob.race}"; if (viewer == parent) { mainDesc += $". When people look at you, they see:\n{Text.Capitalize(parent.gender.He)} {parent.gender.Is} a {mob.race}"; } if (examinedDescription == null || examinedDescription.Length <= 0) { mainDesc += "."; } else if (examinedDescription[0] == '.' || examinedDescription[0] == '!' || examinedDescription[0] == '?') { mainDesc += examinedDescription; } else { mainDesc += $" {examinedDescription}"; } List <string> clothing = parent.GetVisibleContents(viewer, false); if (clothing.Count > 0) { mainDesc += $"\n{theyAre} carrying:"; foreach (string line in clothing) { mainDesc += $"\n{Text.Capitalize(line)}"; } } else { mainDesc += $"\n{theyAre} completely naked."; } foreach (KeyValuePair <string, GameObject> bp in mob.limbs) { if (bp.Value == null) { mainDesc += $"\n{their} {bp.Key} is missing!"; } else { mainDesc += $"\n{their} {bp.Key} is healthy."; } } } else { mainDesc += $"\n{Colours.Fg(examinedDescription, Colours.BoldBlack)}"; if (parent.contents.Count > 0) { List <string> roomAppearances = parent.GetVisibleContents(viewer, false); if (roomAppearances.Count > 0) { mainDesc = $"{mainDesc}\n{string.Join(" ", roomAppearances.ToArray())}"; } } } if (parent.HasComponent(Text.CompRoom)) { RoomComponent roomComp = (RoomComponent)parent.GetComponent(Text.CompRoom); mainDesc = $"{mainDesc}\n{Colours.Fg(roomComp.GetExitString(), Colours.BoldCyan)}"; } if (parent.HasComponent(Text.CompPhysics)) { PhysicsComponent phys = (PhysicsComponent)parent.GetComponent(Text.CompPhysics); mainDesc = $"{mainDesc}\n{phys.GetExaminedSummary(viewer)}"; } viewer.WriteLine(mainDesc); viewer.SendPrompt(); }