mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-08 13:07:33 +08:00
Chore: Remove the use of np.int
This commit is contained in:
parent
4382782130
commit
18cba1f9d0
@ -769,7 +769,7 @@ class ResearchPool:
|
|||||||
Returns:
|
Returns:
|
||||||
np.ndarray: Shape (188,), lower index means to be selected first. 1000 for not selected projects.
|
np.ndarray: Shape (188,), lower index means to be selected first. 1000 for not selected projects.
|
||||||
"""
|
"""
|
||||||
out = np.ones((PROJECTS.count,), dtype=np.int64) * 1000
|
out = np.ones((PROJECTS.count,), dtype=int) * 1000
|
||||||
for index, project in enumerate(self.filter):
|
for index, project in enumerate(self.filter):
|
||||||
if index != self.reset_index:
|
if index != self.reset_index:
|
||||||
out[project.index] = index
|
out[project.index] = index
|
||||||
|
@ -54,8 +54,8 @@ def random_rectangle_vector(vector, box, random_range=(0, 0, 0, 0), padding=15):
|
|||||||
tuple(int), tuple(int): start_point, end_point.
|
tuple(int), tuple(int): start_point, end_point.
|
||||||
"""
|
"""
|
||||||
vector = np.array(vector) + random_rectangle_point(random_range)
|
vector = np.array(vector) + random_rectangle_point(random_range)
|
||||||
vector = np.round(vector).astype(np.int)
|
vector = np.round(vector).astype(int)
|
||||||
half_vector = np.round(vector / 2).astype(np.int)
|
half_vector = np.round(vector / 2).astype(int)
|
||||||
box = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
|
box = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
|
||||||
center = random_rectangle_point(box)
|
center = random_rectangle_point(box)
|
||||||
start_point = center - half_vector
|
start_point = center - half_vector
|
||||||
@ -86,8 +86,8 @@ def random_rectangle_vector_opted(
|
|||||||
tuple(int), tuple(int): start_point, end_point.
|
tuple(int), tuple(int): start_point, end_point.
|
||||||
"""
|
"""
|
||||||
vector = np.array(vector) + random_rectangle_point(random_range)
|
vector = np.array(vector) + random_rectangle_point(random_range)
|
||||||
vector = np.round(vector).astype(np.int)
|
vector = np.round(vector).astype(int)
|
||||||
half_vector = np.round(vector / 2).astype(np.int)
|
half_vector = np.round(vector / 2).astype(int)
|
||||||
box_pad = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
|
box_pad = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
|
||||||
box_pad = area_offset(box_pad, half_vector)
|
box_pad = area_offset(box_pad, half_vector)
|
||||||
segment = int(np.linalg.norm(vector) // 70) + 1
|
segment = int(np.linalg.norm(vector) // 70) + 1
|
||||||
|
@ -74,7 +74,7 @@ def insert_swipe(p0, p3, speed=15, min_distance=10):
|
|||||||
prev = (-100, -100)
|
prev = (-100, -100)
|
||||||
for t in ts:
|
for t in ts:
|
||||||
point = p0 * (1 - t) ** 3 + 3 * p1 * t * (1 - t) ** 2 + 3 * p2 * t ** 2 * (1 - t) + p3 * t ** 3
|
point = p0 * (1 - t) ** 3 + 3 * p1 * t * (1 - t) ** 2 + 3 * p2 * t ** 2 * (1 - t) + p3 * t ** 3
|
||||||
point = point.astype(np.int).tolist()
|
point = point.astype(int).tolist()
|
||||||
if np.linalg.norm(np.subtract(point, prev)) < min_distance:
|
if np.linalg.norm(np.subtract(point, prev)) < min_distance:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ def match_movable(before, spawn, after, fleets, fleet_step=2):
|
|||||||
after = after + fleets
|
after = after + fleets
|
||||||
x = len(after)
|
x = len(after)
|
||||||
y = len(before)
|
y = len(before)
|
||||||
distance = np.ones((y, x), dtype=np.int) * base_weight
|
distance = np.ones((y, x), dtype=int) * base_weight
|
||||||
for i1, g1 in enumerate(before):
|
for i1, g1 in enumerate(before):
|
||||||
for i2, g2 in enumerate(after):
|
for i2, g2 in enumerate(after):
|
||||||
distance[i1, i2] = fleet_step - sum(abs(np.subtract(g1, g2)))
|
distance[i1, i2] = fleet_step - sum(abs(np.subtract(g1, g2)))
|
||||||
|
@ -171,7 +171,7 @@ class Radar:
|
|||||||
for y in range(*self.shape[1]):
|
for y in range(*self.shape[1]):
|
||||||
if np.linalg.norm([x, y]) > radius:
|
if np.linalg.norm([x, y]) > radius:
|
||||||
continue
|
continue
|
||||||
grid_center = np.round(delta * (x, y) + center).astype(np.int)
|
grid_center = np.round(delta * (x, y) + center).astype(int)
|
||||||
self.grids[(x, y)] = RadarGrid(location=(x, y), image=None, center=grid_center, config=self.config)
|
self.grids[(x, y)] = RadarGrid(location=(x, y), image=None, center=grid_center, config=self.config)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user