Fix gaining too much asc pts, reduce reputation gain in gangs.

This commit is contained in:
Olivier Gagnon 2021-06-18 16:53:42 -04:00
parent 8a78ee4cf6
commit 99263309ba
6 changed files with 30 additions and 10 deletions

File diff suppressed because one or more lines are too long

@ -233,12 +233,13 @@ export class GangMember {
ascend(): IAscensionResult { ascend(): IAscensionResult {
const res = this.getAscensionResults(); const res = this.getAscensionResults();
this.hack_asc_points += this.hack_exp; const points = this.getGainedAscensionPoints();
this.str_asc_points += this.str_exp; this.hack_asc_points += points.hack;
this.def_asc_points += this.def_exp; this.str_asc_points += points.str;
this.dex_asc_points += this.dex_exp; this.def_asc_points += points.def;
this.agi_asc_points += this.agi_exp; this.dex_asc_points += points.dex;
this.cha_asc_points += this.cha_exp; this.agi_asc_points += points.agi;
this.cha_asc_points += points.cha;
// Remove upgrades. Then re-calculate multipliers and stats // Remove upgrades. Then re-calculate multipliers and stats
this.upgrades.length = 0; this.upgrades.length = 0;

@ -6,7 +6,7 @@ export const GangConstants: {
Names: string[]; Names: string[];
} = { } = {
// Respect is divided by this to get rep gain // Respect is divided by this to get rep gain
GangRespectToReputationRatio: 5, GangRespectToReputationRatio: 25,
MaximumGangMembers: 30, MaximumGangMembers: 30,
CyclesPerTerritoryAndPowerUpdate: 100, CyclesPerTerritoryAndPowerUpdate: 100,
// Portion of upgrade multiplier that is kept after ascending // Portion of upgrade multiplier that is kept after ascending

@ -3785,6 +3785,7 @@ function NetscriptFunctions(workerScript) {
updateDynamicRam("ascendMember", getRamCost("gang", "ascendMember")); updateDynamicRam("ascendMember", getRamCost("gang", "ascendMember"));
checkGangApiAccess("ascendMember"); checkGangApiAccess("ascendMember");
const member = getGangMember("ascendMember", name); const member = getGangMember("ascendMember", name);
if(!member.canAscend()) return;
return Player.gang.ascendMember(member, workerScript); return Player.gang.ascendMember(member, workerScript);
}, },
setTerritoryWarfare: function(engage) { setTerritoryWarfare: function(engage) {

@ -32,13 +32,18 @@ document.addEventListener("DOMContentLoaded", getGameContainer);
export function createPopup<T>(id: string, rootComponent: (props: T) => React.ReactElement, props: T): HTMLElement | null { export function createPopup<T>(id: string, rootComponent: (props: T) => React.ReactElement, props: T): HTMLElement | null {
let container = document.getElementById(id); let container = document.getElementById(id);
if (container == null) { if (container == null) {
function onClick(this: HTMLElement, event: MouseEvent): any {
//console.log(this.id);
}
container = createElement("div", { container = createElement("div", {
class: "popup-box-container", class: "popup-box-container",
display: "flex", display: "flex",
id: id, id: id,
clickListener: onClick,
}); });
gameContainer.appendChild(container); gameContainer.appendChild(container);
} }
ReactDOM.render(<Popup content={rootComponent} id={id} props={props} />, container); ReactDOM.render(<Popup content={rootComponent} id={id} props={props} />, container);
@ -51,9 +56,10 @@ export function createPopup<T>(id: string, rootComponent: (props: T) => React.Re
*/ */
export function removePopup(id: string): void { export function removePopup(id: string): void {
const content = document.getElementById(`${id}`); const content = document.getElementById(`${id}`);
if (content == null) { return; } if (content == null) return;
ReactDOM.unmountComponentAtNode(content); ReactDOM.unmountComponentAtNode(content);
removeElementById(id); removeElementById(id);
removeElementById(`${id}-close`);
} }

@ -62,6 +62,9 @@ interface ICreateElementStyleOptions {
visibility?: string; visibility?: string;
whiteSpace?: string; whiteSpace?: string;
width?: string; width?: string;
height?: string;
top?: string;
left?: string;
} }
/** /**
@ -210,6 +213,15 @@ function setElementStyle(el: HTMLElement, params: ICreateElementStyleOptions): v
if (params.width !== undefined) { if (params.width !== undefined) {
el.style.width = params.width; el.style.width = params.width;
} }
if (params.height !== undefined) {
el.style.height = params.height;
}
if (params.top !== undefined) {
el.style.top = params.top;
}
if (params.left !== undefined) {
el.style.left = params.left;
}
if (params.backgroundColor !== undefined) { if (params.backgroundColor !== undefined) {
el.style.backgroundColor = params.backgroundColor; el.style.backgroundColor = params.backgroundColor;
} }