Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fc-pregmod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pregmodfan
fc-pregmod
Commits
7995d753
Commit
7995d753
authored
3 years ago
by
ezsh
Browse files
Options
Downloads
Patches
Plain Diff
Add explicit function for autosurgery procedures sorting
parent
da7e0da0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!10545
Rework cosmetic implant surgeries and the RA interface to them
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/js/rulesAutosurgery.js
+14
-4
14 additions, 4 deletions
src/js/rulesAutosurgery.js
with
14 additions
and
4 deletions
src/js/rulesAutosurgery.js
+
14
−
4
View file @
7995d753
...
@@ -91,6 +91,15 @@ globalThis.rulesAutosurgery = (function() {
...
@@ -91,6 +91,15 @@ globalThis.rulesAutosurgery = (function() {
surgeryDamage
(
slave
,
healthCost
);
surgeryDamage
(
slave
,
healthCost
);
}
}
/**
* Computes procedure efficiency for selecting the best one
* @param {App.Medicine.Surgery.Procedure} proc
*/
function
procedureEfficiency
(
proc
)
{
const
value
=
typeof
proc
.
changeValue
===
"
number
"
?
proc
.
changeValue
:
1
.;
return
(
value
/
proc
.
cost
+
value
/
proc
.
healthCost
);
}
/**
/**
* @param {"boobs"|"butt"} bodyPart
* @param {"boobs"|"butt"} bodyPart
* @param {!FC.RA.NumericRange} range
* @param {!FC.RA.NumericRange} range
...
@@ -102,11 +111,12 @@ globalThis.rulesAutosurgery = (function() {
...
@@ -102,11 +111,12 @@ globalThis.rulesAutosurgery = (function() {
const
shallGrow
=
distance
>
0
;
const
shallGrow
=
distance
>
0
;
/** @type {FC.Medicine.Surgery.SizingOptions} */
/** @type {FC.Medicine.Surgery.SizingOptions} */
const
options
=
{
const
options
=
{
types
:
implantTypes
.
length
?
implantTypes
:
null
// we can't set null via RA UI :(
types
:
implantTypes
&&
implantTypes
.
length
?
implantTypes
:
null
// we can't set null via RA UI :(
};
};
options
.
strictTypes
=
options
.
types
&&
options
.
types
.
length
>
0
;
options
.
strictTypes
=
options
.
types
&&
options
.
types
.
length
>
0
;
const
shallReplaceImplantType
=
slave
[
`
${
bodyPart
}
Implant`
]
>
0
&&
const
shallReplaceImplantType
=
slave
[
`
${
bodyPart
}
Implant`
]
>
0
&&
options
.
types
&&
!
options
.
types
.
some
(
v
=>
v
===
slave
[
`
${
bodyPart
}
ImplantType`
]);
options
.
types
&&
!
options
.
types
.
some
(
v
=>
v
===
slave
[
`
${
bodyPart
}
ImplantType`
]);
/** @type {(left: App.Medicine.Surgery.Procedure, right: App.Medicine.Surgery.Procedure) => number} */
let
sorter
;
let
sorter
;
if
(
shallShrink
)
{
if
(
shallShrink
)
{
if
(
range
.
max
===
0
)
{
if
(
range
.
max
===
0
)
{
...
@@ -114,11 +124,11 @@ globalThis.rulesAutosurgery = (function() {
...
@@ -114,11 +124,11 @@ globalThis.rulesAutosurgery = (function() {
}
}
options
.
reduction
=
true
;
options
.
reduction
=
true
;
options
.
replace
=
true
;
options
.
replace
=
true
;
sorter
=
(
left
,
right
)
=>
-
right
.
targetEffect
/
right
.
costs
+
left
.
targetEffect
/
left
.
costs
;
sorter
=
(
left
,
right
)
=>
-
procedureEfficiency
(
right
)
+
procedureEfficiency
(
left
)
;
}
else
if
(
shallGrow
)
{
}
else
if
(
shallGrow
)
{
options
.
augmentation
=
true
;
options
.
augmentation
=
true
;
options
.
replace
=
true
;
options
.
replace
=
true
;
sorter
=
(
left
,
right
)
=>
right
.
targetEffect
/
right
.
costs
-
left
.
targetEffect
/
left
.
costs
;
sorter
=
(
left
,
right
)
=>
procedureEfficiency
(
right
)
-
procedureEfficiency
(
left
)
;
}
}
if
(
!
shallShrink
&&
!
shallGrow
&&
!
shallReplaceImplantType
)
{
if
(
!
shallShrink
&&
!
shallGrow
&&
!
shallReplaceImplantType
)
{
return
;
return
;
...
@@ -128,7 +138,7 @@ globalThis.rulesAutosurgery = (function() {
...
@@ -128,7 +138,7 @@ globalThis.rulesAutosurgery = (function() {
// we allow implant removal because there might be no other way to change its type
// we allow implant removal because there might be no other way to change its type
options
.
types
=
options
.
types
?
[...
options
.
types
,
"
none
"
]
:
[
"
none
"
];
options
.
types
=
options
.
types
?
[...
options
.
types
,
"
none
"
]
:
[
"
none
"
];
options
.
reduction
=
true
;
options
.
reduction
=
true
;
sorter
=
(
left
,
right
)
=>
right
.
targetEffect
/
right
.
costs
-
left
.
targetEffect
/
left
.
costs
;
sorter
=
(
left
,
right
)
=>
procedureEfficiency
(
right
)
-
procedureEfficiency
(
left
)
;
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment