mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 07:05:35 +00:00
Add 'Extreme' roll
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
* Ensure that standard slots are repainted when any component changes
|
* Ensure that standard slots are repainted when any component changes
|
||||||
* Reload page if Safari throws a security error
|
* Reload page if Safari throws a security error
|
||||||
* Handle import of ships with incorrectly-sized slots
|
* Handle import of ships with incorrectly-sized slots
|
||||||
|
* Add 'Extreme' blueprint roll: best beneficial and worst detrimental outcome (in place of 'Average' roll)
|
||||||
|
|
||||||
#2.2.14
|
#2.2.14
|
||||||
* Ensure that jitter is shown correctly when the result of a special effect
|
* Ensure that jitter is shown correctly when the result of a special effect
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
this._toggleSpecialsMenu = this._toggleSpecialsMenu.bind(this);
|
this._toggleSpecialsMenu = this._toggleSpecialsMenu.bind(this);
|
||||||
this._rollWorst = this._rollWorst.bind(this);
|
this._rollWorst = this._rollWorst.bind(this);
|
||||||
this._rollRandom = this._rollRandom.bind(this);
|
this._rollRandom = this._rollRandom.bind(this);
|
||||||
this._rollAverage = this._rollAverage.bind(this);
|
|
||||||
this._rollBest = this._rollBest.bind(this);
|
this._rollBest = this._rollBest.bind(this);
|
||||||
|
this._rollExtreme = this._rollExtreme.bind(this);
|
||||||
this._reset = this._reset.bind(this);
|
this._reset = this._reset.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,20 +185,6 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
this.props.onChange();
|
this.props.onChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Provide an 'average' roll within the information we have
|
|
||||||
*/
|
|
||||||
_rollAverage() {
|
|
||||||
const { m, ship } = this.props;
|
|
||||||
const features = m.blueprint.grades[m.blueprint.grade].features;
|
|
||||||
for (const featureName in features) {
|
|
||||||
let value = (features[featureName][0] + features[featureName][1]) / 2;
|
|
||||||
this._setRollResult(ship, m, featureName, value);
|
|
||||||
}
|
|
||||||
this.setState({ modifications: this._setModifications(this.props) });
|
|
||||||
this.props.onChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide a random roll within the information we have
|
* Provide a random roll within the information we have
|
||||||
*/
|
*/
|
||||||
@@ -227,6 +213,20 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
this.props.onChange();
|
this.props.onChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide an 'extreme' roll within the information we have
|
||||||
|
*/
|
||||||
|
_rollExtreme() {
|
||||||
|
const { m, ship } = this.props;
|
||||||
|
const features = m.blueprint.grades[m.blueprint.grade].features;
|
||||||
|
for (const featureName in features) {
|
||||||
|
const value = Math.abs(features[featureName][0]) < Math.abs(features[featureName][1]) ? features[featureName][1] : features[featureName][0];
|
||||||
|
this._setRollResult(ship, m, featureName, value);
|
||||||
|
}
|
||||||
|
this.setState({ modifications: this._setModifications(this.props) });
|
||||||
|
this.props.onChange();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset modification information
|
* Reset modification information
|
||||||
*/
|
*/
|
||||||
@@ -252,8 +252,8 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
const _toggleBlueprintsMenu = this._toggleBlueprintsMenu;
|
const _toggleBlueprintsMenu = this._toggleBlueprintsMenu;
|
||||||
const _toggleSpecialsMenu = this._toggleSpecialsMenu;
|
const _toggleSpecialsMenu = this._toggleSpecialsMenu;
|
||||||
const _rollBest = this._rollBest;
|
const _rollBest = this._rollBest;
|
||||||
|
const _rollExtreme = this._rollExtreme;
|
||||||
const _rollWorst = this._rollWorst;
|
const _rollWorst = this._rollWorst;
|
||||||
const _rollAverage = this._rollAverage;
|
|
||||||
const _rollRandom = this._rollRandom;
|
const _rollRandom = this._rollRandom;
|
||||||
const _reset = this._reset;
|
const _reset = this._reset;
|
||||||
|
|
||||||
@@ -278,6 +278,7 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
const showSpecial = haveBlueprint && this.state.specials.length > 0;
|
const showSpecial = haveBlueprint && this.state.specials.length > 0;
|
||||||
const showSpecialsMenu = specialMenuOpened;
|
const showSpecialsMenu = specialMenuOpened;
|
||||||
const showRolls = haveBlueprint && !blueprintMenuOpened && !specialMenuOpened;
|
const showRolls = haveBlueprint && !blueprintMenuOpened && !specialMenuOpened;
|
||||||
|
const showReset = !blueprintMenuOpened && !specialMenuOpened;
|
||||||
const showMods = !blueprintMenuOpened && !specialMenuOpened;
|
const showMods = !blueprintMenuOpened && !specialMenuOpened;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -287,26 +288,30 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
onContextMenu={stopCtxPropagation}
|
onContextMenu={stopCtxPropagation}
|
||||||
>
|
>
|
||||||
<div className={ cn('section-menu', { selected: blueprintMenuOpened })} style={{ cursor: 'pointer' }} onClick={_toggleBlueprintsMenu}>{blueprintLabel}</div>
|
<div className={ cn('section-menu', { selected: blueprintMenuOpened })} style={{ cursor: 'pointer' }} onClick={_toggleBlueprintsMenu}>{blueprintLabel}</div>
|
||||||
{ showBlueprintsMenu ? this.state.blueprints : '' }
|
{ showBlueprintsMenu ? this.state.blueprints : null }
|
||||||
{ showSpecial ? <div className={ cn('section-menu', { selected: specialMenuOpened })} style={{ cursor: 'pointer' }} onClick={_toggleSpecialsMenu}>{specialLabel}</div> : '' }
|
{ showSpecial ? <div className={ cn('section-menu', { selected: specialMenuOpened })} style={{ cursor: 'pointer' }} onClick={_toggleSpecialsMenu}>{specialLabel}</div> : null }
|
||||||
{ showSpecialsMenu ? this.state.specials : '' }
|
{ showSpecialsMenu ? this.state.specials : null }
|
||||||
{ showRolls ?
|
{ showRolls || showReset ?
|
||||||
<table style={{ width: '100%', backgroundColor: 'transparent' }}>
|
<table style={{ width: '100%', backgroundColor: 'transparent' }}>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{ showRolls ?
|
||||||
<tr>
|
<tr>
|
||||||
<td> { translate('roll') }: </td>
|
<td> { translate('roll') }: </td>
|
||||||
<td style={{ cursor: 'pointer' }} onClick={_rollWorst} onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_WORST')} onMouseOut={tooltip.bind(null, null)}> { translate('worst') } </td>
|
<td style={{ cursor: 'pointer' }} onClick={_rollWorst} onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_WORST')} onMouseOut={tooltip.bind(null, null)}> { translate('worst') } </td>
|
||||||
<td style={{ cursor: 'pointer' }} onClick={_rollAverage}onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_AVERAGE')} onMouseOut={tooltip.bind(null, null)}> { translate('average') } </td>
|
|
||||||
<td style={{ cursor: 'pointer' }} onClick={_rollBest}onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_BEST')} onMouseOut={tooltip.bind(null, null)}> { translate('best') } </td>
|
<td style={{ cursor: 'pointer' }} onClick={_rollBest}onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_BEST')} onMouseOut={tooltip.bind(null, null)}> { translate('best') } </td>
|
||||||
|
<td style={{ cursor: 'pointer' }} onClick={_rollExtreme}onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_EXTREME')} onMouseOut={tooltip.bind(null, null)}> { translate('extreme') } </td>
|
||||||
<td style={{ cursor: 'pointer' }} onClick={_rollRandom} onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_RANDOM')} onMouseOut={tooltip.bind(null, null)}> { translate('random') } </td>
|
<td style={{ cursor: 'pointer' }} onClick={_rollRandom} onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_RANDOM')} onMouseOut={tooltip.bind(null, null)}> { translate('random') } </td>
|
||||||
<td style={{ cursor: 'pointer' }} onClick={_reset}onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_RESET')} onMouseOut={tooltip.bind(null, null)}> { translate('reset') } </td>
|
</tr> : null }
|
||||||
</tr>
|
{ showReset ?
|
||||||
|
<tr>
|
||||||
|
<td colSpan={'5'} style={{ cursor: 'pointer' }} onClick={_reset}onMouseOver={termtip.bind(null, 'PHRASE_BLUEPRINT_RESET')} onMouseOut={tooltip.bind(null, null)}> { translate('reset') } </td>
|
||||||
|
</tr> : null }
|
||||||
</tbody>
|
</tbody>
|
||||||
</table> : '' }
|
</table> : null }
|
||||||
{ showMods ?
|
{ showMods ?
|
||||||
<span onMouseOver={termtip.bind(null, 'HELP_MODIFICATIONS_MENU')} onMouseOut={tooltip.bind(null, null)} >
|
<span onMouseOver={termtip.bind(null, 'HELP_MODIFICATIONS_MENU')} onMouseOut={tooltip.bind(null, null)} >
|
||||||
{ this.state.modifications }
|
{ this.state.modifications }
|
||||||
</span> : '' }
|
</span> : null }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ export const terms = {
|
|||||||
PHRASE_ENGAGEMENT_RANGE: 'The distance between your ship and its target',
|
PHRASE_ENGAGEMENT_RANGE: 'The distance between your ship and its target',
|
||||||
PHRASE_SELECT_BLUEPRINT: 'Click to select a blueprint',
|
PHRASE_SELECT_BLUEPRINT: 'Click to select a blueprint',
|
||||||
PHRASE_BLUEPRINT_WORST: 'Worst primary values for this blueprint',
|
PHRASE_BLUEPRINT_WORST: 'Worst primary values for this blueprint',
|
||||||
PHRASE_BLUEPRINT_AVERAGE: 'Average primary values for this blueprint',
|
|
||||||
PHRASE_BLUEPRINT_RANDOM: 'Random selection between worst and best primary values for this blueprint',
|
PHRASE_BLUEPRINT_RANDOM: 'Random selection between worst and best primary values for this blueprint',
|
||||||
PHRASE_BLUEPRINT_BEST: 'Best primary values for this blueprint',
|
PHRASE_BLUEPRINT_BEST: 'Best primary values for this blueprint',
|
||||||
|
PHRASE_BLUEPRINT_EXTREME: 'Best beneficial and worst detrimental primary values for this blueprint',
|
||||||
PHRASE_BLUEPRINT_RESET: 'Remove all modifications and blueprint',
|
PHRASE_BLUEPRINT_RESET: 'Remove all modifications and blueprint',
|
||||||
PHRASE_SELECT_SPECIAL: 'Click to select an experimental effect',
|
PHRASE_SELECT_SPECIAL: 'Click to select an experimental effect',
|
||||||
PHRASE_NO_SPECIAL: 'No experimental effect',
|
PHRASE_NO_SPECIAL: 'No experimental effect',
|
||||||
@@ -115,6 +115,7 @@ export const terms = {
|
|||||||
average: 'Average',
|
average: 'Average',
|
||||||
random: 'Random',
|
random: 'Random',
|
||||||
best: 'Best',
|
best: 'Best',
|
||||||
|
extreme: 'Extreme',
|
||||||
reset: 'Reset',
|
reset: 'Reset',
|
||||||
|
|
||||||
// Weapon, offence, defence and movement
|
// Weapon, offence, defence and movement
|
||||||
|
|||||||
Reference in New Issue
Block a user